title: PhantomJS with embedded web server uses only one CPU
body: <p>I have a problem using PhantomJS with web server module in a multi-threaded way, with concurrent requests.<br>
  I am using PhantomJS 2.0 to create highstock graphs on the server-side with Java, as explained <a href="http://www.highcharts.com/docs/export-module/setting-up-the-server" rel="nofollow">here</a> (and the code <a href="https://github.com/highslide-software/highcharts.com/tree/master/exporting-server/java" rel="nofollow">here</a>).
  It works well, and when testing graphs of several sizes, I got results that are pretty consistent, about 0.4 seconds to create a graph.</p>
  
  <p>The code that I linked to was originally published by the highcharts team, and it is also used in their export server at <a href="http://export.highcharts.com/" rel="nofollow">http://export.highcharts.com/</a>. In order to support concurrent requests, it keeps a pool of spawned PhantomJS processes, and basically its model is one phantomjs instance per concurrent request.</p>
  
  <p>I saw that the webserver module supports up to 10 concurrent requests (explained here), so I thought I can tap on that to keep a lesser number of PhantomJS processes in my pool. However, when I tried to utilize more threads, I experienced a linear slow down, as if PhantomJS was using only one CPU. This slow-down is shown as follows (for a single PhantomJS instance):</p>
  
  <p>1 client thread, average request time 0.44 seconds.<br>
  2 client threads, average request time 0.76 seconds.<br>
  4 client threads, average request time 1.5 seconds.</p>
  
  <p>Is this a known limitation of PhantomJS? Is there a way around it?</p>
  
  <p>(question also posted <a href="https://groups.google.com/forum/#!topic/phantomjs/48PLdYftCJQ" rel="nofollow">here</a>)</p>