I feel you about the polyglot and tend to agree, but I think some people are really trying to force awkward things into node, like people attempting to write big full-stack webapps using it.
I feel you about the polyglot and tend to agree, but I think some people are really trying to force awkward things into node, like people attempting to write big full-stack webapps using it.
Also callbacks to me are kind of like parenthesis in Lisp. They're annoying but they're for the greater good. :)
Is your problem with threads or shared mutable state? Web applications should be stateless and can be written as long request-response pipelines on-top of a pool of actor threads, with the only shared state existing at either ends of the pipeline, probably hidden by a framework anyways.
There are plenty of async idioms that make callbacks a breeze.
Would all the developers writing apps on node.js who are doing 10,000+ concurrent requests per process please stand up?
You obviously haven't written a lot of async code so not sure why you're so against the idea.
Also, I'd say I've written enough code on top of node.js to be qualified to comment on this. Here's some of it that's open source:
https://github.com/rbranson/glob-trie.js https://github.com/rbranson/twerk https://github.com/rbranson/node-ffi
At one stage I had the same train of thought that you have (http://chris6f.com/synchronous-nodejs / https://github.com/chriso/synchronous/blob/master/lib/protot...) - it would be nice to have the option of fibers, but it's not going to happen.
IMO async code isn't as difficult or ugly as you make it out to be. Is async code as easy to write and follow as sync code? No. Is it worth the benefits I've mentioned? For me, yes.
This sounds like a tacit admittance that you're willing to deal with it because you don't think you have other options, but you do. There is at least one CPS compiler for Node (TameJS), and there are other languages that allow for the same result, but more straightforward implementations of concurrent code (Erlang, Ocaml/LWT, Haskell). I'm not saying you should use though, but we can do better and we should, even if it's just compiling back to JS in the end.
The cost of hosting a webapp tends to be a rounding error in contrast to the cost of developing the webapp.
The additional benefit is that I can take the same program and handle 20,000+ concurrent users on two servers— which is when I suddenly become very glad that my hardware costs are significant compared to my dev costs.
That's a weird way to look at it, unless you're in the webapp hosting business? For everyone else there is usually only one webapp that they care about.
I can take the same program and handle 20,000+ concurrent users on two servers
Sorry to break it, but that's not how it works. Unless you have one of those rare webapps that never need to touch a database.
Anyway, what's good for the webapp hosting business is good for web developers, and what's good for web developers is good for the technical ecosystem in general (and then the world). Of course going from VPSes to EC2s was a significant improvement. But that isn't as good as it gets. EC2 rates were cheap already, but when Az started the free tier it represented a significantly lower barrier to entry. That's good for everyone.
And seriously, come on. This is a way of making programs run faster, and not a little faster, but a hundred times faster. It's the very definition of technological progress. It's absurd that we're here arguing about whether it matters or not.
Sorry, but if anything then that statement is absurd.
Faster than what? And where's that "hundred times faster" figure coming from?
It seems there's a bit of a misconception about the bottlenecks and cost structure in real world web applications.
Rails (aka the slowest web framework known to man) is popular because it trades hardware for development velocity. Hardware is cheap, developer salaries are not.
But node multiplies that, a lot. Which is nice, because you know it won't break or slow down if a bunch of people use it for some reason. And so you don't have to re-architect your system for a while longer, which is valuable time.
Yes. Rails is measured in hundreds per second. Node in thousands per second.
The point that you still seem to be missing is that the monetary amounts involved have normally turned into a rounding error long before you reach a traffic-volume where this difference becomes relevant.
Or, in other words, hosting a "webapp" already is nearly free in terms of hardware.
4000+ requests being sent every second to the server in total, the server is a single node process.