Page 1 of 4 123 ... LastLast
Results 1 to 10 of 33

Thread: Announcing SilkJS

  1. #1
    Sencha - Ext JS Dev Team mschwartz's Avatar
    Join Date
    Nov 2008
    Location
    San Diego, Peoples' Republic of California
    Posts
    2,056
    Vote Rating
    19
      0  

    Default Announcing SilkJS

    I am pleased to announce SilkJS, a V8 based Swiss Army Knife (and HTTP server).

    SilkJS currently compiles for Linux and Mac OSX, but should port trivially to any flavor of Unix. It was originally written for Ubuntu Linux and ported to OSX (a FreeBSD flavored Unix) in under 2 hours.

    So what is it?

    SilkJS is a C++ program that links with the Google V8 JavaScript engine and several other libraries. It provides as simple and direct as it can, methods that make calling operating system and those other libraries' functions from JavaScript context.

    Running SilkJS is as simple as:
    Code:
    path_to/SilkJS some_javascript_file.js
    SilkJS simply loads the specified JavaScript file, compiles it, runs it, then calls a main() function provided by the script. Any additional arguments on the command line are passed to the main() function.

    SilkJS is not NodeJS. It merely provides the "glue" to the operating system and other library functions to make them callable from your JavaScript program.

    I wrote an HTTP server almost entirely in JavaScript using SilkJS that's included with SilkJS. The HTTP server is a pre-fork model server, and it's very fast. I was able to run ab (apache benchmark) against it with 20,000 concurrent requests and it served a 13.3K file 50,000 times in under 3 seconds with no errors. It is several times faster than NodeJS at serving NodeJS' sample "hello, world" demo on the nodejs.org home page. It is 30x or more faster than Apache and PHP 5.3 at running real world server-side business logic.

    I also wrote a console program in JavaScript using ncurses that technically minded webmasters will find quite useful. It refreshes the screen once per second, displaying in real-time the CPU usage, memory usage, disk activity, and virtual memory. With this program, you can tell if a busy WWW server is CPU, memory, and/or disk bound. Or if it's swapping heavily.

    SilkJS comes with a number of library interfaces built-in. These include console I/O, file system I/O, the gd2 graphics library, MySQL, ncurses, networking, and process management (fork, wait, etc.).

    nodejs.org is served by ngnix, not by nodejs. SilkJS can be viewed at http://silkjs.org/ and it is entirely served by SilkJS itself.

    SilkJS may be downloaded and used freely from github at http://github.com/mschwartz/SilkJS.

    Please see the Wiki http://github.com/mschwartz/SilkJS/wiki, it contains more details about building SilkJS, benchmarks, example programs, etc. Of particular interest to us ExtJS developers is the ORM, which fully supports ExtJS DataStore.

    I've started a Google Group for supporting SilkJS at http://groups.google.com/group/silkjs

    Check it out!

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,421
    Vote Rating
    1271
      0  

    Default

    Dude... this is awesome! I have just converted my stuff from Apache to Node but will play around with this. When I do get time and any updates... expect some forking going on!
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha - Ext JS Dev Team mschwartz's Avatar
    Join Date
    Nov 2008
    Location
    San Diego, Peoples' Republic of California
    Posts
    2,056
    Vote Rating
    19
      0  

    Default

    To add to my previous post...

    The idea of compiling and running the script on the command line, then calling its main() function is so you can load up your library or API, then actually run your main business logic.

    So:

    Code:
    include('lib/Util.js');
    // include more stuff...
    
    function main() {
      // call stuff in lib/Util.js
    }
    SilkJS comes with an installer (for Linux):
    Code:
    ./SilkJS Install.js
    It creates a /usr/local/bin/SilkJS binary, and /usr/share/SilkJS where it copies lib/ and appropriate other files.

    If you pass include() an absolute path, it looks for the file there, otherwise it looks in the current directory then /usr/share/SilkJS.

    It also supports shebang:

    Code:
    #!/usr/local/bin/SilkJS
    
    // file is ./hello.js
    function main() {
      println('hello, world');
    }
    chmod 755 ./hello.js

    then you can run hello.js:
    ./hello.js

    If you don't have access to Ubuntu, you can install it in VirtualBox (http://virtualbox.org). Download the ISO from http://ubuntu.com (I use the server version, not the desktop one).

    The ORM works on top of MySQL. It's documented here: http://github.com/mschwartz/SilkJS/wiki/Schema.js.

    The ORM is designed to work with ExtJS and DataStores, though it's flexible enough to do anything.

  4. #4
    Sencha - Ext JS Dev Team mschwartz's Avatar
    Join Date
    Nov 2008
    Location
    San Diego, Peoples' Republic of California
    Posts
    2,056
    Vote Rating
    19
      0  

    Default

    Not on the wiki yet is Jst.

    The HTTP server will statically serve .html, .css, .js, .jpg, etc., files. If it sees a .jst extension on a file, it loads it and runs it.

    What is Jst? It's a lot like JSP (or PHP), except the language is JavaScript AND you can call any function of any class you've done include() on in your main program.

    Code:
    <% var title = 'Hello from Jst'; %>
    <html>
      <head>
        <title><%= title %></title>
      </head>
      <body>
        <h1>Users</h1>
        <ul>
    
    <% forEach(SQL.getDataRows('SELECT * FROM Users'), function(user) { %>
          <li><%= user.username %></li>
    <% } %>
    
        </ul>
      </body>
    </html>
    <%
    // any JavaScript can go here
    %>

    <%= JavaScript expression %>
    (emits result of the expression)

  5. #5
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,748
    Vote Rating
    128
      0  

    Default

    sounds promising, i will check it out when i find some free time!
    Best regards
    Tobias Uhlig

  6. #6
    Sencha - Ext JS Dev Team mschwartz's Avatar
    Join Date
    Nov 2008
    Location
    San Diego, Peoples' Republic of California
    Posts
    2,056
    Vote Rating
    19
      0  

    Default

    28 people watching the repository on github after 2 days.

  7. #7
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,748
    Vote Rating
    128
      0  

    Default

    it's a start
    Best regards
    Tobias Uhlig

  8. #8
    Sencha - Services Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966
    Vote Rating
    15
      0  

    Default

    Sweet Mike!
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  9. #9
    Sencha - Ext JS Dev Team mschwartz's Avatar
    Join Date
    Nov 2008
    Location
    San Diego, Peoples' Republic of California
    Posts
    2,056
    Vote Rating
    19
      0  

    Default

    26 of those 28 yesterday alone. 13 overnight.

    I haven't even been doing any "marketing" of it yet. I'm hoping to have silkjs.org WWW site up this week and then I have people who run JS blog sites wanting to write about it.

    For my next JSMag article, I will write about how to integrate SilkJS' ORM with ExtJS grids in 250 lines of code or less.

  10. #10
    Sencha User
    Join Date
    Jan 2008
    Posts
    64
    Vote Rating
    -1
      0  

    Default

    I am mostly interested in applications for this project for developing / testing extjs app .
    Can we use that for unit testing, for intellisense or for anything useful?

Page 1 of 4 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •