I have a problem using PhantomJS with a web server module in a multi-threaded way with concurrent requests.
I am using PhantomJS 2.0 to create server-side highstock charts with Java, as explained here (and the code here ). 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.
The code I linked to was originally published by the highcharts team and is also used on the export server http://export.highcharts.com/ . To support concurrent requests, it stores a pool of generated PhantomJS processes, and basically its model is a single instance of phantomjs for a simultaneous request.
I saw that the web server module supports up to 10 concurrent requests (explained here), so I thought I could use this to save fewer PhantomJS processes in my pool. However, when I tried to use more threads, I experienced linear slowdown, as if PhantomJS was using only one processor. This slowdown is displayed as follows (for one instance of PhantomJS):
1 client thread, average request time 0.44 seconds.
2 client threads, average request time 0.76 seconds.
4 client threads, average request time 1.5 seconds.
Is this a known limitation of PhantomJS? Is there any way around this?
(the question is also posted here )
source share