News for hackers. Stuff that matters.
Re:Ask HN: Why Node.js and for which type of App? by santiagobasulto on Saturday July 04, 2015 @09:46AM (#9830119)
TL;DR: Apps that perform high I/O.

For example, if your app is just getting data from a database and returning it to the user, 90% of your time will be spent:

* Receiving the user's request (Network, IO)

* Fetching something from the DB (Network, IO)

* Returning the data (Network, IO)

That's a good scenario for an event based system like Node.js.

Try not to use node.js if you're CPU-bound: rendering images or PDF, processing sound, etc. If you do need to do something like that and you still want to use node.js you should use a processing queue.

Re:Ask HN: Why Node.js and for which type of App? by fleitz on Saturday July 04, 2015 @11:21AM (#9830400)
The processing queue is kinda irrelevant, CPU bound tasks require lots of CPUs, and more CPUs if you want a processing queue.

Since Node / nginx are already processing queues it's kinda pointless to add another one.

Re:Ask HN: Why Node.js and for which type of App? by ph0o on Saturday July 04, 2015 @09:55AM (#9830139)
Thanks!

So, you would use node.js just as a service to process data on the server side and not as a application for the desktop (with a gui)?

Re:Ask HN: Why Node.js and for which type of App? by sova on Saturday July 04, 2015 @10:17AM (#9830197)
Typically Node.js is for high I/O web applications. Thanks to the wonderful asynchronicity of javascript (callbacks "let me know when this is ready/done") it's really wonderful for browser-based programs.

However, there is growing discussion about using Node.js for desktop applications. Please see https://nodesource.com/blog/node-desktop-applications

Re:Ask HN: Why Node.js and for which type of App? by fleitz on Saturday July 04, 2015 @11:25AM (#9830416)
Node also works well for desktop apps because it's got the run loop.

Desktop apps are insanely high frequency IO apps, basically, its an Input Queue reading the mouse / keyboard / touch screen and a run loop, which is exactly what node is, except node originally envisioned the input queue being web requests. And most desktop apps are single threaded on the UI.