Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Using Selenium, Docker, and Cloud for Performance Testing

DZone 's Guide to

Using Selenium, Docker, and Cloud for Performance Testing

All three of these technologies come together to make it possible to performance engineers to load test applications within a browser.

· Performance Zone ·
Free Resource

Image title


Growing up as performance engineer in the last decade, it was almost impossible to think of simulating load using a real browser because a performance engineer would need a lot of machines to simulate load using a real browser. Performance engineers used to have a couple of desktop or servers to simulate hundreds and thousands of users load. Their preferred choice used to be to capture HTTP/s requests using tools like LoadRunnerJMeterSoasta, and Neoload.

An application with custom protocol, proprietary security features, or dynamic webpage content used to pose a great challenge for performance engineering. Traditionally, performance engineers will use tools like load runner's click/web or RTE protocols or tools like Apploader to deal with such an application.

However, performance engineers now have cloud and Docker to mitigate infrastructure challenges. Open source automation test tools like Selenium with Chrome headless browser is a powerful way to simulate using Docker containers.

I personally faced a similar challenge while testing the Atlassian Confluence product upgrade and infrastructure migration. Our goal was to simulate various page load and plugin usages as close to production as possible and verify if there are any stability issues with the new version.

If you have used Confluence, you might have noticed that there are a bunch of HTTP calls as the page starts to render and these calls could be different from page to page as the user can use different plugins or macros on the page.

I choose to use a very simple approach for Confluence load test:

Find most view pages in the last 30 days and their % distribution in the total mix.

This was easy as web server logs were stored in Splunk. I could easily get % distribution and peak number of page loads per hour in the last few months. Now I had the workload that I need to simulate. I used a couple of Python scripts to create a data file to repeat URI according to % distribution. Now I have all the page URLs that I need to simulate per hour.

Find a Simple as Easy Way to Simulate Load

Traditional request response-based tools would not work, or it would hard to simulate all the HTTP requests from each page without recording each page manually. A simple Selenium script to log in, load a couple of pages, and edit a few pages randomly would simulate the type of user behavior that we were looking to emulate.

How would you use a Selenium script to generate concurrent user load? With the use of the cloud and Docker. Below is a simple diagram to depict how I used Docker containers with Chrome Headless Browser, performance utilitiess to capture performance navigation timings, such as page load, DOMcomplete and AWS ECS cluster and task to run Docker container with different users using task overrides. I used a local Python script to start multiple AWS tasks with different user credential as environment variables.

This enables me to simulate user load on Confluence in a very simple and easy way. I used Tableau viz to track page load timing and the worst performing pages. New Relic is used to track JVM and host health.

Using Selenium scripts with headless browser for load testing helps in simulating proper user behavior and  saves a lot of scripting effort as well, which we might have to spend with request/response base tools.

Image title


Although I did not use a real browser in this case, I think the headless browser is good enough for page load validations. All scripts that I have used for this work are in this GitHub Repo.

Please take a look and reuse if you have similar needs.

Topics:
perfromance ,atlassian ,confluence ,aws and devops ,selenium ,headless chrome

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}