Hacker News new | ask | show | jobs
by jeswin 5368 days ago
The problem is that fibonacci was a bad choice in your example and it proved nothing.

It is fairly easy to scale node with multiple processes. As long as you don't have a long running (such as fibonacci) operation. If you do have tasks like that, process outside node and check for completion. Like how Tasks work in Google App Engine.

Also, most other web stacks will discourage you from running a 30s fib on a thread processing web requests. This isn't specific to node.

Node and coffeescript has worked really well for us. Product coming out later this month.

[EDIT: Just noticed that several other people pointed out the same thing. Looks like most node users are aware of potential problems, but I can see such issues being confusing for new users.]

2 comments

> Also, most other web stacks will discourage you from running a 30s fib on a thread processing web requests. This isn't specific to node.

Difference being, with other stacks a request running for 30s will have little impact on the rest of the machine. With node, the whole server gets stuck, not just that precise request and the machine resources necessary to perform the computation (or whatever).

The fib example is extreme, but it's rooted into a real issue of cooperative multitasking: code does not always behave correctly and is not always perfect. You might have used a quadratic algorithm and it ran in 10ms on 10 items or so, but in production it happens a user is getting it to run on a hundred or a thousand items, and now other users are severely affected, in that their requests are completely frozen while the computation is going on. There are hundreds of other possibilities, small inefficiencies, shortcuts, plain bugs, etc... which are basically going to break your node application.

Only if you're crazy enough to put something in production running a single node instance.
Even if you're not "crazy enough" to do what's prescribed, every user routed to the locked node instance will still be locked. You're just reducing the surface area of the freeze.
Presumably not many requests will be routed to the locked instance - that's why it's called load "balancing".

And you shouldn't have any long-running computation on your server process anyway.

I think this happens fairly often.
It is fairly easy to scale node with multiple processes. As long as you don't have a long running (such as fibonacci) operation.

- - - -

Which is like the WHOLE POINT of the original article...