Skip to content
This repository
Browse code

Add readme for fibonacci example

  • Loading branch information...
commit 87a15129a096ee3384f232389c2088b9c935de3d 1 parent 4b9c6b3
Steve Campbell authored April 10, 2012

Showing 1 changed file with 15 additions and 0 deletions. Show diff stats Hide diff stats

  1. 15  examples/readme.md
15  examples/readme.md
Source Rendered
... ...
@@ -0,0 +1,15 @@
  1
+PerfectAPI has a unique scaling strategy.  It automatically scales the HTTP load across all available CPUs, and leaves the main process (your code) with its own single CPU that can run in parallel with the HTTP requests and responses.  This example demonstrates how to take that even further and make use of more CPU power for your own code.
  2
+
  3
+Now normally this is not necessary.  It becomes necessary when your own code becomes CPU intensive, e.g. doing mathematical calculations or just having a lot of code behind a single method. 
  4
+
  5
+The example in this folder has 3 files:
  6
+
  7
+ - `fib.json` - describes the example api
  8
+ - `fib.js` - the code for the api
  9
+ - `fibworker.js` - a file with code that is launched in its own process for calculating a fibonacci sequence
  10
+ 
  11
+There are two techniques demonstrated in the example.  The first (`randomfib2`) demonstrates using a single long-lived worker process to handle all requests.  This has the benefit of insulating the other API methods from the CPU usage of that method.
  12
+
  13
+The second (`randomfib3`) demonstrates launching multiple long-lived worker processes, each of which is used in a round-robin manner.  This makes use of all available CPU.
  14
+
  15
+There are [some benchmarks](http://gist.github.com/2118651) that make use of this example to demonstrate the potential for performance gains under load.

0 notes on commit 87a1512

Please sign in to comment.
Something went wrong with that request. Please try again.