JavaScript Servers Compared
snydeq writes "InfoWorld's Peter Wayner test-drives five leading JavaScript servers and finds the results compelling though still a work-in-progress. 'I enjoyed the challenge and stimulation of rethinking everything I know about the server, but I still found myself hesitant to push these new ideas too far or too fast. The speed of experimentation and development is heady and exciting to the open source crowd, but it will probably seem scary to corporate developers who like the long, stable lives of tools from Microsoft or Oracle. Some of these platforms will probably morph three or four times over the next few years, something that won't happen to the good, old JSP standard in the Java world,' Wayner writes in review of Node.js, Jaxer, EJScript, RingoJS, and AppengineJS."
Second post! Would've been first if slashdot had a faster javascript server.
Third post! Would've been first if slashdot had a faster javascript server.
First post! Good thing slashdot has a fast javascript server.
Burn the bible
Or, i dunno... maybe we could use JavaScript to add flexible dynamic scripting to our existing stable Java platforms? ...otherwise what's the point? To use a domain specific language for tasks it wasn't designed for or is very good at?
Personally, I'd rather use a slow dynamic scripting language to glue the fast compiled language code together, (see: Perl), not write the whole damn server in slow JS.
Hint: Just use Rino and be done with this nonsense.
Read the print version of the article in one page:
http://www.infoworld.com/print/161969
+1 Funny Signature
Shhhh.... (quietly) every generation has to reinvent the wheel so they can have a job. Don't tell anybody. Just keep your mouth shut.
To use a domain specific language for tasks it wasn't designed for or is very good at?
JavaScript works very well as something it wasnt designed for every time you use GMail, Meebo or any other application that's running within the browser these days.
Just the tip of the fudberg:
- States 2MB for each Java thread created (WTF... Where did they pull this number? Isn't the default stack size for each thread 512KB?)
- "Just as businesses try desperately to avoid tying up capital in inventory, a programmer's job is to think like a factory boss, treat RAM as capital, and avoid consuming any of it." (Holy Crap, don't know where to start! Aren't we in the age of memory is the new disk? Use it wisely, don't avoid using it all together!)
They are all slow, insecure, malware engines.
Remember when javascript had a terrible rep? Then people were all like, "No! It's totally awesome! It has first-class functions and prototypal inheritance!" Yeah, you remember. You read all the blogs. You had flashbacks to your not-so-pleasant encounters with javascript while developing client-side web applications. Then, all the sudden, prototypal inheritance became the in-thing, like popped collars. No matter how ugly or ridiculous it looked, you didn't want to be the only one who didn't think it was cool. You started writing gobs of hard to organize, impossible to refactor serverside javascript code. You convinced yourself, somehow, that you saved time by not having to issue some "compile" command. No, it just starts, DYNAMICALLY! What a cool word, dynamic -- like Ugg boots! And like wearing Ugg boots in the summertime, you tortured yourself searching for simple runtime errors. Static checking? Compiling? These are the things of white-collared enterprise folks.
You are not a white collared enterprise guy. You are a renegade. With a popped-collar. And ugg boots.
Similes are like metaphors
Personally, I'd rather use a slow dynamic scripting language to glue the fast compiled language code together, (see: Perl), not write the whole damn server in slow JS.
That is the whole idea. Write processor intensive tasks in a fast compiled language (C or whatever) and glue them with a server that is good at handling asynchronous requests. That's what Node.js is about and JavaScript is actually a good fit for it because of closures.
just because of historical accident...thats the only extension mechanism available
if i were going to design a full featured application i wouldn't choose javascript
hmm, maybe thats why the google applications are actually compiled into javascript instead of
being written in it
Except that JavaScript, today, is not a slow dynamic scripting language. The latest JS engines in IE 9, FF 4, and Chrome are lightning fast. You'll be hard pressed to find a faster dynamically typed scripting language today. Honestly, if you want a fast, dynamically typed, interpreted scripting language, then look no further than JS. Also Rhino IS slow (compared to most other JS interpreters) and has been included with Java by default since Java 6.
wow, how is JavaScript on the server side new?
anyone remember the Netscape FastTrack server, and the LiveWire environment, where LiveScript was used to code both server & client side of a web application. LiveScript being of course the original name of JavaScript. this was back in 1996, merely 15 years ago...
history seems to repeat itself...
We used to call it "SSJS" -- server-side Javascript. Times really have not changed, but why would you expect them to? Despite the superficial changes, the underlying structure of the Internet and the Web has not really changed. We have not really seen much in the way of "revolution" in the past 15 years, just incremental changes (or if you would prefer, "improvements") to the way everything works.
Palm trees and 8
You must not remember anything from having read about it, given that the first line of TFA is "in 1996 ... Netscape took its shiny, new JavaScript language from the browser and stuck it in the Netscape Enterprise HTTP server."
"I'm increasingly convinced this asynchronous callback style of programming is too difficult for most developers to manage," Robinson said. "Without extreme discipline it can easily lead to 'callback hell,' with deeply nested callbacks and complex code to implement logic that would be simple on a synchronous platform." What's next for him? He sees the older framework being rethought and reworked using the best ideas from Node.js. In place of callbacks, he sees ideas like "promises," "co-routines," "actors," and other objects that hang on to the information in the variables for use later. These objects may be easier to juggle than the callbacks.
Callbacks and promises are not mutually exclusive. In particular, a promise API can be built on top of callbacks. This has been well-understood for a long time in both the Ajax world (e.g. dojo.Deferred), and in Node.js development (e.g. node-promise module by Kris Zyp). So, I think this critique is a bit unwarranted.
We do remember it. Probably because it was the first line of the article.
Or .jsp, which has been around for quite a long time.
There is definitely a "fanboy" mentality among Node.js programmers, which is really irritating.
I use Node.js to create command-line scripts, similar to bash scripts. It's great! The secret is to install the Fibers package, which can help turn all those annoying asynchronous Node.js calls into synchronous calls.
Asynch is great for building web servers... not so much when you just want to run a script from top to bottom, and don't care about blocking the thread.
Also, you'll notice that if you use Node.js for web application development, you will be tabbing over quite a bit as the asynch functions are nested inside each other.
history seems to repeat itself...
This.
Don't worry - I'm pretty sure that, 10 years down the line, they'll be touting the addition of static typing to JavaScript as the next big thing to improve productivity etc.
But there's something just worrisome in my mind to be using dynamic typed functional languages. I get bugged out by Python and JavaScript because they offer too much flexibility. Try debugging lower levels of SproutCore without mountains of headaches. I'm going to plug Scala, just because the contract for functions is clearer than in Python or Javascript.
Not really. 15 years is a long time in technology.
Too bad that chrome's V8 javascript engine does not support multithreading, thereby making itself unsuitable for server-side scripting.
(Of course, you can run each script in a separate process, but that is way too expensive)
If Pandora's box is destined to be opened, *I* want to be the one to open it.
really it's not changed. I'd think about that again? Where have you been?
Why wasn't it designed for those applications? It's a general purpose programming language. Perhaps the browser's APIs (DOM) weren't designed with those applications in mind, but even the first standardization of the DOM (DOM Level 1) APIs could implement most if not all of those applications' features, one way or another (eg. submitting forms to a frame—a feature introduced with JavaScript in Netscape 2—and periodically appending new scripts which contain server data).
There's a lot of reasons that those kinds of applications didn't appear until later, but they could have been made much sooner. But poor standards support in browsers made interoperability a nightmare, slow client hardware made performance questionable, and ultimately poor understanding of JavaScript and the DOM delayed serious uptake among developers for about a decade.
It seems the author of the article knows little about how real servers use multithreading to reduce latency.
From the article:
Node.js is one good solution. It uses only one thread for your server and everything runs within it. When the requests come flying in, Node.js takes them one at a time and hands them to the single function that was specified when the server is invoked.
Sadly, one of the best javascript engines is V8 (used in google chrome), and it does not support multithreading.
If Pandora's box is destined to be opened, *I* want to be the one to open it.
No, but I fucked your dad's ass 5 minutes ago.
What like when they added closure support for Java. Yawn!
hmm, maybe thats why the google applications are actually compiled into javascript instead of being written in it
No idea why this was posted anonymously.
+1 Profoundly Fucking Insightful
The Javascript engines in browsers come nowhere close to the runtimes for the mainstream server-side platforms (J2EE, .NET, etc) in performance. It's not always orders of magnitude difference anymore, but one of those runtimes will still reliably be several times faster than the fastest JS engines.
Yup mod parent up.
so someone has re-invented ASP (with Jscript) and its now cool?
Hi. We (I'm a google employee) have GWT, which compiles java to javascript, but we don't actually use it much. Most projects I'm aware use Javascript written as javascript. We do use build scripts to pre-process, include dependencies, and minimize/obfuscate, though.
I said the underlying structure has not changed much, but that there have been superficial changes. Can you please point out where the underlying structure of the Internet or the Web has undergone a significant change? When last I checked, we are still using IPv4 and we are still using HTTP, and we are still using a client-server model. This most significant change that I can think of is AJAX, and that is not a terribly significant change (it really just means that things people would have done in an applet can now be done by the browser itself).
Yes, things look a lot different now, and we are making more sophisticated use of the underlying technology (sometimes), but for the most part we are still talking about the same system.
Palm trees and 8
I've been intrigued by this whole serverside js thing since i started doing a lot of flex and therefore using actionscript a lot. :)
Callbacks are so cool
But thing is js is still a mess if you have a lot of code.
What we really need is server side actionscript to get proper OO syntax, strong typing and namespaces.
If i ever got that, i'd be a happy camper !
uhm, thats pretty much EXACTLY what Javascript was intended for ... you do know where it came from ... right?
Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
Your definition of 'lightning fast' is my definition of 'painfully slow language' even in the new JS engines.
Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
In terms of numerical computation? Probably. In terms of actual useful web applications, Node.js meets or beats compiled Java in the benchmarks that I've seen, even with the Java Code using esoteric and not commonly used behaviours like Non-Blocking IO: http://www.subbu.org/blog/2011/03/nodejs-vs-play-for-front-end-apps
V8 is actually really damn fast.
jsp is java, not javascript, which is entirely different other than the name.
Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
Yes the underlying structure is much the same. But our paradigms have changed a lot. The early web was request response, with very little focus on the client at all. That's changed, there is now far more parity between what happens on the server and client. This is only going to increase. The point is this, if you have a common language (Javascript) that fits the web, very, very well and you have browser vendors implementing features in HTML5 that encourage distributed, real time apps. Together with improvements in HTTP1.1 (which is really one of the main drivers). Then you have a web that in reality looks nothing like the one we had 15 years ago. What I don't understand if the fear people seem to exhibit with stuff like this. There is absolutely nothing wrong with a modern implementation of server side Javascript. There is nothing wrong with single threaded apps, there is also nothing wrong with multi-threaded. Single threaded systems can have certain qualities that perhaps multi-threaded apps don't. They certainly use resources in a much more effective way. We don't need multi threaded-ness everywhere. These are tools. Use them. Technology changes, embrace that.
You could use JScript in ASP too. Thankfully I never had to.
Dilbert RSS feed
I assume you write all your web apps in machine code then?
Ah,
It meant I didn't have to bother learning VB in order to write ASP Pages, and it looked a lot closer to the PHP, C and Java I was used to writing.
Err... <%@ Language=Javascript%>
"They'll come back. Technology is cyclical"
-- The beeper king
I prefer my webservers to run purely on ASICs. Sure, updating the web site is a little costly, but I can handle more traffic than Amazon.
Honestly, if you want a fast, dynamically typed, interpreted scripting language, then look no further than JS.
Honestly? Well, honestly, the more code I write/debug in dynamically-typed interpreted languages, the more I like statically-typed compiled languages (and it has nothing to do with execution speed)
I'm about 8 years out of date on my web development, but can someone give me a quick rundown on the subject of the article vs. what I know as server side javascript, aka ASP classic?
Karma: Can only be portioned out by the Cosmos.
The desktop computer hasn't changed much in the past 30 years. I mean, we still have a keyboard, a monitor, and some little collection of copper and silicon connecting the two and it still uses the same ol' electricity. Sure the operating systems have changed, the applications have changed, the keyboard might be virtual, the monitor might be 3 inches tall, and you might be using 5 different computers throughout the day for so many different/diverse tasks that your life is rather different from what it would have been 30 years ago. But it's still just superficial changes, we're still talking about the same system.
</rant> Yeah maybe a bit over the top there. I actually agree with you to some extent, but then most every advance in technology just comes at incremental steps. It's not like Swan/Edison/Others went from the light bulb to the iPad over a fortnight. And sometimes some overlooked technology which wasn't up to the challenge 10~15 years ago could suddenly be useful in the more modern Web X.0 era.
Maybe it's not a whole new wheel, but the fancy round shape has worked pretty well for us for a while.
Err, did I just compare the buzz of server-side Javascript with the jump from incandescent light bulbs to tablet computers? I apologize. I did not get enough sleep last night, and my AC died this morning so it is ridiculously hot in my house right now.
Unless it's been updated recently it's still single threaded. So, if you have a multicore server - as I'm sure most do, it'll only be using 1 of those cores in its single thread. Of course you could fire up 4 instances for a 4-core machine, but then the threads can't communicate, so you lose one of its advantages (being ideal for chat/game servers, or anything that uses real-time message passing between clients.)
On my own dev server - (Core 2 Quad, 2.5ghz, 4GB, RAID) Node.js can handle around 8000 requests per second, when just outputting a simple text message. In comparison, PHP can handle around 12,000 requests per second to return the same text. However, PHP/Apache is using all 4 cores for this, and Node.js just 1. So it's doing over half the work with 1/4 the resources. The tests were conducted using ab with 100 concurrent requests.
I can definitely see a case being made for using Node.js to handle AJAX requests from a page served via Apache (or some other webserver.) It seems absolutely ideal for this - also for a site offering realtime chat, since at worst it will only take up a single core, and not cause too many problems with the rest of a site.
they are supposed to add statically typed closure you insensitive claud !
Jehovah be praised, Oracle was not selected
My favourite language, by far, is Scala, so don't think I don't know where you are coming from. And, honestly, my favourite dynamic language is Python, though I am using JS on occasion now.
Nobody would.
Javascript is adequate. I am never going to complain that Javascript somehow keeps me from doing my job. I can do anything in Javascript. I have bigger fish to fry and the need to occasionally write Javascript doesn't make the list of my "real" problems.
But Javascript sucks. It is wrong. I would rather program in PHP (!) than Javascript. (Maybe even perl? Well, no. I would rather program in Javascript than perl.) But anyway: Classes. Prototypes are lame. Anyone who starts a new project involving Javascript in any situation other than running in a web browser, is totally fucked in the head. Someone has so many choices and they pick Javascript? Please. Yes, it can function as a general-purpose programming language, but it's not one, and it is very sad that the world is possibly going to be forever burdened by it.
Damn you, Netscape. You may end up being a longer-lasting plague than Microsoft.
As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
I guess it wasn't obvious, but I was comparing JS to other dynamically typed scripting languages. I'm also talking in respect to tasks that scripting languages usually tackle. If JS is painfully slow for you, I'm just assuming you are using it for something you probably shouldn't be using ANY scripting language for.
The bottleneck on a dynamic webserver is either network or SQL access times. It does not matter if you have the fastest web server software in assembly when it takes 1,000 ms to access a SQL query to display for a client's browser.
Static it is a different story, but who besides a small mom pop page uses simply static pages anymore? So this is why Java took off a decade ago while slashdotters scratched their head wondering why could something so slow and slugish could ever scale. It is about SQL
http://saveie6.com/
Guess what.
The leading proponent of all 5 Javascript Server projects is....Intel!
Sleep your way to a whiter smile...date a dentist!
Can you put a current processor in a motherboard from '95?
Can you install DOS to a x64 processor system?
Well, no because the structure of things changed.
Thank you.
what just like Java was originally designed for set top boxes and fridges? Oak. anyone, anyone?
Jeepers. You really didn't read that linked post nor understand it - that is a comparison of a *very* slow interpreted stack running on top of java, it is not java/jsp/jee or anything close. Nor is it comparing it deployed in any remotely production quality scenario which would use much more host networking features to significantly boost throughput.
Go back to your JS & enjoy it by all means, but don't make laughable comments about it being so much faster than java as a generic statement. I'm also fairly certain that node.js has been very heavily devloped toward quick http serving, not nescessarily all the other logic possibly used to serve a request...
... optimized animated .gif server so ytmnd.com could load 5GB loops faster.
I8-D
- It has idiosyncracies, but several orders of magnitude fewer than PHP.
- It is standardized and has multiple, F/OSS implementations
- Its syntax has much less line noise
- It probably has the fastest implementations of all scripting languages; last time I checked (might have changed) the only contender was LUA-jit or something.
- The various implementations are thoroughly stress tested in browsers by something like a billion users.
- Similarly the high stakes in browser securities guarantee that there is a strong incentive for security and more generally code quality compared to other scripting languages.
when an article starts out with "As the standard Java Servlet container creates one thread for each request..." you know the rest of the article has to be flawed