WebDriver with PhantomJS - performance on multiple instances

748 views
Skip to first unread message

restell...@gmail.com

unread,
Jan 17, 2014, 4:17:02 AM1/17/14
to seleniu...@googlegroups.com
Hello everyone.
My requirements are to launch at the same time, on a single machine, some website navigations (up to 6 times simultaneously).
I've done this with C# using the .NET bindings with the PhantomJSDriver.

Everything seems to work good but the execution time changes with the number of instances opened.
Like: 1 instance - 16 seconds, 3 instances - 25 seconds each, 5 instances - 40 seconds each.

The cpu/memory of the machine doesn't seems to be overloaded...
I've tried different websites, but problem always occurs...

Have you by any chance have any idea of what could be the problem?

Thank you very much

restell...@gmail.com

unread,
Jan 22, 2014, 4:25:08 AM1/22/14
to seleniu...@googlegroups.com
Update:

With more test, I noticed that if I execute more navigation sequentially, without close the driver,
only the firsts ones suffer a considerable slowdown...

Here's some code:

var drivers = new List<IWebDriver>();
for (int i = 0; i < 3; i++)
{
   
var phantomService = new PhantomJSDriverService.CreateDefaultService();
    phantomService
.Port = 9190 + i;
    drivers
.Add(new PhantomJSDriver(phantomService));
}

Parallel.Invoke(
   
() =>
   
{
       
Navigation01(drivers[0]);    //<-- slow
       
Navigation01(drivers[0]);
   
},
   
() =>
   
{
       
Navigation02(drivers[1]);    //<-- slow
       
Navigation02(drivers[1]);
   
},
   
() =>
   
{
       
Navigation03(drivers[2]);    //<-- slow
       
Navigation03(drivers[2]);
   
});

Basically I don't like the idea to manage a pool of PhantomJs instances, I'd like to open/close the driver for each navigation I made.

Ken P

unread,
Jan 24, 2014, 5:08:41 PM1/24/14
to seleniu...@googlegroups.com
>>Like: 1 instance - 16 seconds, 3 instances - 25 seconds each, 5 instances - 40 seconds each.

Even if your cpu/mem doesn't looked stressed, you could still be core-bound (not enough cores to service all of the threads spawned in a true parallel fashion).

In these cases I like modeling the test in JMeter when at all possible...that will give an idea of the optimal number of threads to run.
Reply all
Reply to author
Forward
0 new messages