Browse files

Add readme for fibonacci example

  • Loading branch information...
1 parent 4b9c6b3 commit 87a15129a096ee3384f232389c2088b9c935de3d @DukeyToo DukeyToo committed Apr 10, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 examples/
@@ -0,0 +1,15 @@
+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.
+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.
+The example in this folder has 3 files:
+ - `fib.json` - describes the example api
+ - `fib.js` - the code for the api
+ - `fibworker.js` - a file with code that is launched in its own process for calculating a fibonacci sequence
+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.
+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.
+There are [some benchmarks]( that make use of this example to demonstrate the potential for performance gains under load.

0 comments on commit 87a1512

Please sign in to comment.