Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stress test simulating heavy load using Selenium

I have a system to test, which is a video ads distribution technology. I need to load every video like 1-2 mins to serve the ads. The videos are played in a Flash client and streamed as FLV streams like in YouTube.

The reason why I need to test it only via browsers -- and every other method won't work -- is to stress test both the video streaming servers and the ads servers simultaneously and displaying ads in real-time.

I have used Selenium, WatiN, Automation Anywhere and many other automation tools. However, when I am trying to start like 10000 browsers on my machine (32GB RAM, 16-core CPU), none of them are able to do the job.

With Selenium, I am able to start the maximum FireFox instances so far, but that's still too low: half of the instances don't run the test.

Any suggestions to do with Selenium?

like image 281
Sumit Ghosh Avatar asked Mar 26 '12 17:03

Sumit Ghosh


People also ask

Can Selenium be used for stress testing?

JMeter and Selenium are both used for web application testing. But the main difference is that JMeter is mostly used to test the performance of web applications under load and stress. On the other hand, Selenium is best suited for automation and cross browser testing of a website.

Can we do load testing using Selenium?

Using Selenium for load testing is not recommended. Whereas JMeter is well suited for high-load performance tests, especially through Blazemeter, Selenium is more suited for UI functional tests.

What is the difference between load testing and stress testing?

Load testing and stress testing are both types of performance testing, which check how your application performs when many people use it at once. While load testing simulates real-life application load, stress testing tests application performance at peak times.

What is the relationship between load testing and stress testing of a system?

The key difference is the goal of each: Load tests help you understand how a system behaves under an expected load. Stress tests help you understand the upper limits of a system's capacity using a load beyond the expected maximum.


2 Answers

You aren't going to run 10,000 browsers on your machine. That would give 3.2MB of physical memory per browser instance and I'm pretty sure FireFox just won't like that.

You could create a JMeter script that hits your server with many threads. It won't interact with the UI but would simulate the load of many clients hitting whatever URLs you tell it. I believe it also includes the ability to record a session and play it back for easy setup of your sessions.

like image 167
digitaljoel Avatar answered Nov 15 '22 14:11

digitaljoel


Selenium isn't really optimized for load/stress testing, especially if you're running your browsers locally. Running 1000+ browsers is going to choke even the beefiest server. Though RAM is an obvious bottleneck, you also have limited CPU resources and bandwidth. The latter being a primary concern if you are loading videos.

Not to mention you'd be testing from a single IP with 10k browsers, so load balancing may not kick in properly, as well as the actual distribution of video ads to specific virtual users.

If you want to stick with existing Selenium tests, I've had good experiences with BrowserMob. They basically have a huge grid to do real browser load-testing, distributed across AWS.

Another recommendation would be an actual performance testing tool. I'd recommend Soasta CloudTest. They have a free version that runs 100 users so you can see if it will be a good fit for you. I have found that scripting for CloudTest is relatively simple.

Disclaimer: My experiences with both companies have been as a paying customer and I have never worked for either.

like image 32
kenki Avatar answered Nov 15 '22 16:11

kenki