2

I'm trying to decide whether it's worth the time to invest into learning Node.js for a new program. The biggest benefit AFAIU is that Node makes the process of multiple users accessing the same data more efficient than using Apache and PHP.

The program is meant to be used by groups, with all the data stored on our dedicated server. That said, the same data would be accessed by at most all the members of one group (up to 20), but the database itself might be accessed by anyone using the program (for fun, let's say up to 1 million).

My idea of concurrency is basic at best. Would Node.js improve the experience for the groups (since they are accessing the same data), or for everyone (since they are accessing the same database)? Alternatively, is such a set-up even taking advantage of Node's benefits?

1
  • Databases spawn new threads for incoming requests anyway. For a given database system, I don't think node.js will magically enable it to handle more connections than it would with any other driver. Jan 27, 2012 at 19:27

2 Answers 2

2

The answer is "probably".

It sounds like you should play with Node and learn its strengths and weaknesses. Node excels at high throughput 'realtime' network services, as such there is almost always a use-case for Node in any web project. For your project this might mean handling web socket/ajax requests, or perhaps you'll boot up a node cluster to handle processing of tasks as a background service.

Like all tech, Node doesn't solve every problem and other technologies will (probably) get certain tasks done faster. It's about learning enough to know when to deploy Node (and when you might consider another tool).

At worst, you'll learn more about javascript; knowledge you can re-use on a myriad of devices, and every web browser. At best you'll learn to use a great tool that fits your needs.

Also: your understanding of "multiple users accessing the same data" is incorrect. Yes, Node is good at many concurrent users/connections, but Node has no care (DNGAF) for what data you're accessing. That would be handled by your database or caching layer.

2
  • Thanks. I'll look into Node. The situation I'm afraid of is writing a bunch of PHP code, then having to ultimately replace it with Node code. Anyway, only one true way to see!
    – Voriki
    Jan 28, 2012 at 2:53
  • If you have reasonably static data, caching will give you the most performance benefits, far more than changing serverside language. Generating dynamic data fast is important, but caching and statically serving as much content/assets as possible is your performance priority #1.
    – timoxley
    Jan 28, 2012 at 7:45
1

Based on your description, you really don't need node, or any specific server stack so much as intelligent caching of data. There is nothing inherent in node which will make this easier than php, ruby, .net, etc.

The benefit you're referring to is likely that node can handle multiple concurrent requests very well and it can handle long requests that wait on IO well since node doesn't hang on IO (meaning the server can continue to handle other requests).

If you want to learn node, GO FOR IT! I am working with it personally and I love it, but it isn't a magic bullet and if you are already invested in a server stack, you would probably be better served using that and spending your time learning about efficient caching.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.