Navigation Menu

Skip to content

Why does Fugue exist?

Pedro Teixeira edited this page Oct 6, 2010 · 2 revisions

Why does node.js need Fugue?

Why do you need multiple processes when one node process can serve multiple concurrent requests? Unlike Unicorn, one Node.js process can serve multiple request at the same time, so why do I need mode than one process?

The truth is... not everyone needs this.

To start with, you don't need this if you are using Node.js as a client instead of a server - like when you are consuming a twitter stream.

Also, if you have a small project that does not consume much CPU, you don't need to distribute node across multiple cores. One is enough.

But, in this case, I think Fugue can become useful. Just launch it with one worker, and you have automatic worker restart and easy app restarts with no downtime.

In the case of a heavy-load app, I think they can benefit from having node in multiple cores (unless you are just using Node as a dumb pipe - which is not the most usual case). If you are doing JSON or XML processing, or some other task that requires you to stop your event loop for a little while, or even if you are afraid garbage collection may be stealing you precious event loop cycles, you can benefit from having another process waiting to serve more connections.