No longer in active development or just stable

137 views
Skip to first unread message

Matt Harrison

unread,
Jul 8, 2014, 9:49:49 AM7/8/14
to sil...@googlegroups.com
I was wondering if SilkJS still in active development ? I noticed that there was a pull request that hasn't been actioned in a year.
Or is it just considered stable enough ?

Regards,

Matt

Eric Dykstra

unread,
Jul 8, 2014, 2:48:45 PM7/8/14
to sil...@googlegroups.com
Matt,

I am surprised that Mike has not chimed in yet. He must be traveling today or something.

It is probably more accurate to state that it is stable. I use it in a production environment, and anytime I have had an issue, Mike has responded REALLY quick with a bug fix IF that was the issue. Usually, it has been an issue with my code, not SilkJS. Still, Mike has been extremely supportive.

I wish more people used SilkJS. Depending on your application, it can be a MUCH better way to go, than NodeJS. It does not have 'Callback Hell' issues, and it is WAY WAY FASTER! If you are using ExtJS from Sencha, it integrates tightly.

What it is lacking, is a large user base and all the tools that come with that. Having said that, there are many tools used with NodeJS projects, that can be used with SilkJS projects too. Sure, you may need to have NodeJS installed to use those tools, but your app would still be written with and run in SilkJS.

I started SilkJS before NodeJS. I have since been writing some NodeJS code for a client. I like SilkJS much better.

The 'Phase 2' part of my project is going to transfer a TON of data. I am comfortable I made the right choice going with SilkJS. It will scale easily compared to NodeJS et al.

Cheers,

Eric

Matt Harrison

unread,
Jul 8, 2014, 4:56:24 PM7/8/14
to sil...@googlegroups.com
Eric,

Mike did reply directly, pdq as well explaining that it SilkJS is used in productive use, and also toting his decaf project.... :)
I found SilkJS when trying to find a synchronous js server as the asyn/callback in node was driving me potty.

I'm going to have a play over the next few weeks, but I did manage to get it compiled today so that's a good start.

Matt

Donald Organ

unread,
Jul 8, 2014, 7:51:25 PM7/8/14
to sil...@googlegroups.com
What is this decaf project?
--
You received this message because you are subscribed to the Google Groups "SilkJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to silkjs+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eric Dykstra

unread,
Jul 8, 2014, 9:01:32 PM7/8/14
to sil...@googlegroups.com
Related: http://moduscreate.com/javascript-and-the-jvm/

To unsubscribe from this group and stop receiving emails from it, send an email to silkjs+unsubscribe@googlegroups.com.

Mike Schwartz

unread,
Jul 9, 2014, 12:25:11 AM7/9/14
to Eric Dykstra, sil...@googlegroups.com
I’m cc’ing the silkjs google group.  Lots of info here might be of interest to all.

You don’t need to write Java.  You CAN, but you don’t have to.  For SilkJS, any library you’d want to have had to be C++ wrappers around the library functions and linked into SilkJS binary.  With decaf, you can call anything in any Java .jar file on your path.  Decaf does some magic to assure things for modules are on your classpath.  However, I’ve written pure JS modules that wrap around the Java functions and provide you with pure JS callable API with little or no hint of Java to your app.  The one exception is Java Byte Arrays are used for binary data.  Java has ‘em, why not use ‘em? :)

Your code should be quite similar to your SilkJS code.  However, you will be able to spawn threads now, and your HTTP children can share variables across requests.  This is one of the driving factors for me to work on decaf in the first place.  Threads, semaphores, and shared variables.

Performance?  Rhino is notoriously slower than V8.  But it really depends on what you’re doing.  Reading from files and querying databases?  You won’t see much of a difference.  Calculating images pixel by pixel?  Rhino will be 10x slower.  In terms of the http server, decaf is about 1.5x faster than SilkJS at returning a “hello, world” response programatically, and well over 10x faster than a single threaded NodeJS.

Rhino is not going to have some radical changes to its API. Neither is Nashorn, the JS interpreter for Java 8.

I am not a Java guy!

Decaf uses bower:  
Not NPM..  

Bower installs from github repositories into a bower_components/ directory in your project.  Any require() you do searches bower_components automatically.  Thus, we can break up Decaf into lots of smaller bower components and use just what you want in your project.  Like, no need for mongodb drivers if you’re using MySQL.  Many NodeJS modules can be installed with bower and decaf does support them - like HoganJS, MomentJS, etc.  Ones that rely on nodejs’ async methods are not going to port easily, though I think it’s very possible.

Your project’s bower.json might look like:

{
 …
 dependencies: [
    “decaf” : “git://github.com/decafjs/decaf#master”,
    “decaf-jolt” : “git://github.com/decafjs/decaf-jolt#master”,
    “jquery” : “2.x”,
    “moment”: “2.x”,
  ]
}

So you’re actually using bower to install decaf and the decaf-jolt module along with jQuery and moment.  In your decaf main.js/app.js/boostrap.js/whatever, you can:

var Application = require(‘decaf-jolt’).Application,
     SjsServer = require(‘decaf-jolt’).SjsServer,
    app = new Application();

app.verb(‘/‘, new SjsFile(‘/some/path/to/my/root.sjs’));

// when URL / is fetched, /some/path/to/my/root.sjs is executed, sjs works like in SilkJS.

Note decaf-jolt is in bower_components/decaf-jolt directory.  Decaf finds it for require().

Please take time to read the wiki page about decaf’s require() implementation.  I think it might be the best implementation anywhere.  It supports pure commonJS modules, NodeJS style modules (module.exports), and for directories: package.json or bower.json or index.js.

You can also:

var moment = require(‘moment’);

This loads the moment date library/API for use in your decaf app.

You would put this shell script in your project root to be able to run decaf:

#!/bin/sh
# chmod this script 700
./bower_components/decaf/bin/decaf $@

If you then run:

% ./decaf.sh your_app.js

It runs your app

If you provide no app.js parameter, it does REPL mode like SilkJS.

If you run:

%./decaf.sh debug your_app.js

You get a windowed debugger, something like developer tools for chrome, but server-side.






To answer another one of your questions, can you switch on req.host like you are now in SilkJS?  Yep!

See the example Web server?  You get called with a req and res object for every request.  You can examine req.host and do whatever you like.
This example WWW server happens to be 100% compatible with the example on the nodejs.org home page.

The http module (comes with decaf) is documented here:

I provided decaf-jolt.  Please look at this URL.  I just now moved over the current (pretty good!) documentation for Jolt.

It is a WWW application framework something along the lines of expressjs (inspired by it but not a clone).  If you don’t like it, you can trivially roll your own.

I will work on breaking out decaf-mysql tomorrow.

I am always looking for collaborators, even if it’s just to write test/example programs or documentation :)



Mike Schwartz


On Jul 8, 2014, at 7:09 PM, Eric Dykstra <edyk...@selectedventures.com> wrote:

Mike,

Trying to wrap my head around decafJS;

1. Do I need to write Java? (Ugh)
2. Does it integrate with ExtJS like SilkJS does?
3. What is performance like compared to SilkJS?
4. Is there more of a 'NPM' like infrastructure leveraged by decafJS?
5. Can I use one decafJS server to serve multiple apps like I am with SilkJS? (Using HttpChild.requestHandler)

I am months away from the 'Phase 2' part of my project, and migrating now would be pretty easy. I didn't realize that Google could 'force your hand' so easily.

Thanks!

Eric


On 07/08/2014 09:24 PM, Mike Schwartz wrote:
Note I’m not dropping SilkJS support.  Google may force my hand, though, as the API is a radically moving target and at some point, editing many thousands of lines of code just to fix it to call their latest API may not be feasible without many hours.  That’s why SilkJS is a snapshot of an earlier version of V8.

Code written for SilkJS shouldn’t be a huge porting project.  For example, I’ve implemented a MySQL module with Schema class that’s identical to the SilkJS one.  I haven’t exactly been making it public that decafJS exists.  It has been in a private repo with a similar kitchen sink set of modules/API as SilkJS.  I’ve been breaking out those modules into bower installable modules.

DecafJS itself is installable via bower.  I’ll put together a demo project using bower to install everything soon.

One of the huge benefits of DecafJS is that it is threaded instead of process oriented.  This means all your child “processes” become threads and can share variables.

If you all have any questions about it, let me know.




Mike Schwartz


To unsubscribe from this group and stop receiving emails from it, send an email to silkjs+un...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


-- 
---------------------------
Eric Dykstra
Selected Ventures Inc.
Phone: (705) 481-1742
EMail: edyk...@SelectedVentures.com






Mike Schwartz

unread,
Jul 9, 2014, 12:33:27 AM7/9/14
to Eric Dykstra, sil...@googlegroups.com
One thing I didn’t mention in my previous long email is that decaf supports ascii WebSockets, mongodb, and many other things that were “difficult” to handle in SilkJS.

In SilkJS, you had child processes, so you had to have one connection to MySQL per HTTP child.

In Decaf, you have MySQL connection pool.  Many of the Java libraries implement their own connection pools.  For Decaf, I wrote my own.



I’m impressed that you can concisely describe a connection pool in JavaScript in so few lines of code.  It’s elegant, and simple.

You will note it does some Java API calls (java.lang.Class.forName).  Well, this is in the MySQL module that you would require(), the Java code is buried in the more familiar SilkJS-like MySQL API you’re used to.  The connection pools are done under the hood, automatically.

For grins, I prespawned 5000 child threads.  The memory used was on the order of 400MB on my 64-bit iMac.  On a 1.7G RAM cheap Amazon instance, you’d be using just 25% of the RAM and could handle a really large number of simultaneous requests, web sockets, etc.


Mike Schwartz


On Jul 8, 2014, at 7:09 PM, Eric Dykstra <edyk...@selectedventures.com> wrote:

Mike,

Trying to wrap my head around decafJS;

1. Do I need to write Java? (Ugh)
2. Does it integrate with ExtJS like SilkJS does?
3. What is performance like compared to SilkJS?
4. Is there more of a 'NPM' like infrastructure leveraged by decafJS?
5. Can I use one decafJS server to serve multiple apps like I am with SilkJS? (Using HttpChild.requestHandler)

I am months away from the 'Phase 2' part of my project, and migrating now would be pretty easy. I didn't realize that Google could 'force your hand' so easily.

Thanks!

Eric


On 07/08/2014 09:24 PM, Mike Schwartz wrote:
Note I’m not dropping SilkJS support.  Google may force my hand, though, as the API is a radically moving target and at some point, editing many thousands of lines of code just to fix it to call their latest API may not be feasible without many hours.  That’s why SilkJS is a snapshot of an earlier version of V8.

Code written for SilkJS shouldn’t be a huge porting project.  For example, I’ve implemented a MySQL module with Schema class that’s identical to the SilkJS one.  I haven’t exactly been making it public that decafJS exists.  It has been in a private repo with a similar kitchen sink set of modules/API as SilkJS.  I’ve been breaking out those modules into bower installable modules.

DecafJS itself is installable via bower.  I’ll put together a demo project using bower to install everything soon.

One of the huge benefits of DecafJS is that it is threaded instead of process oriented.  This means all your child “processes” become threads and can share variables.

If you all have any questions about it, let me know.




Mike Schwartz


On Jul 8, 2014, at 6:01 PM, Eric Dykstra <virtu...@gmail.com> wrote:

To unsubscribe from this group and stop receiving emails from it, send an email to silkjs+un...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Mike Schwartz

unread,
Jul 9, 2014, 8:41:40 AM7/9/14
to Eric Dykstra, sil...@googlegroups.com
MySQL module is on github.com now:



Mike Schwartz


On Jul 8, 2014, at 9:33 PM, Mike Schwartz <myk...@gmail.com> wrote:

One thing I didn’t mention in my previous long email is that decaf supports ascii WebSockets, mongodb, and many other things that were “difficult” to handle in SilkJS.

In SilkJS, you had child processes, so you had to have one connection to MySQL per HTTP child.

In Decaf, you have MySQL connection pool.  Many of the Java libraries implement their own connection pools.  For Decaf, I wrote my own.

<PastedGraphic.png>

Eric Dykstra

unread,
Sep 12, 2014, 4:41:24 PM9/12/14
to sil...@googlegroups.com, edyk...@selectedventures.com
Re: 

On Wednesday, 9 July 2014 00:25:11 UTC-4, mschwartz wrote:
I’m cc’ing the silkjs google group.  Lots of info here might be of interest to all.

Mike,

I just re-read the post. LOTS of good info in there. (Haven't read the info linked to yet. Will soon.) I might be starting a new project, and I am considering decafJS.

How much effort is it to write a PostgreSQL Module? Could I easily follow the MySQL module and go from there? Or, is there an existing solution that can be used?

If YOU were starting a new project with decafJS, what else would be in the 'stack'? 

Cheers,

Eric

Michael Schwartz

unread,
Sep 12, 2014, 5:20:57 PM9/12/14
to sil...@googlegroups.com, edyk...@selectedventures.com
I made this WWW site with decafjs:  www.mbrea.net.

The back end is decaf with mongodb for the database.  The HTML is rendered server-side with hoganjs.  There are several modules installed with bower that decaf require()s without modification, like moment and accounting, and hogan.  Bower is also used to install client side modules like twitter bootstrap and assorted assist for that.  The line between client and server blurs because the modules are all in the bower_components directory! and some are used on both sides even.

You can use the decaf MySQL module if you like.  It features the familiar Schema class.  I bet most of your db logic doesn't change.

Not only do I use bower to install 3rd party modules, I use it to install decaf and decaf-* modules as well.

For mbrea, I wrote several command line tools that run outside the http environment that share code with it.

Not one bit of async logic in any of the JavaScript.

I'm quite satisfied that decaf is good.  Mbrea home page loads for me in sub 1/2 second.  The back end is doing 5 mongodb queries to populate the news, events, featured member, pages list drop down, etc.  hogan is rendering the entire page, which is written as templates that include multiple partials.  All that and still sub 1/2 second.  And the server is 500+ miles away, to boot.

Mbrea server has uptime of 33 days.  When no traffic, the CPU is fully idle.  I see zero memory leaks.  It sure seems plenty stable.  Do note I have nginx in front of it to handle https when the client gets me the needed certificates.

Decaf does not do SSL https on its own.  However, unlike SilkJS, it does do gzip.  It also does WebSockets.

If you decide to try it, I'll give you the expected support.  If you find some documentation or example programs are needed, I'll make that happen.
--
Reply all
Reply to author
Forward
0 new messages