Skip to content

Instantly share code, notes, and snippets.

View DukeyToo's full-sized avatar

Steve Campbell DukeyToo

  • Minneapolis, MN, USA
  • 13:11 (UTC -05:00)
View GitHub Profile
@DukeyToo
DukeyToo / benchmark.md
Created March 19, 2012 16:42
Benchmarks exploring different patterns of Node.js worker processes on an HTTP server

This set of benchmarks explores the impact on a Node.js HTTP API server when some responses take more cpu than others. The requests are to a JSON page that calculates a random fibonacci sequence between 1 and 30. The server is using node-perfectapi with a feature that scales the http server across available cpus, while leaving the user's API code in the main Node.js process.

In the red series, the http server is running in the same process as the Fibonacci calculations. In the green series, the handling of all of the http web server stuff has been moved to separate node workers. In both cases, the Fibonacci calculations occur in a single thread in the main (master) Node process.

Benchmark showing response time hit

Now obviously the red series is going to be slower than the green series (because it is restricted to a single cpu for both http requests/responses and the calculati