Load Testing Your Drupal Website: Avoid Points of Contention

You’d hate to have your business struggle for critical resources such as skilled employees, Internet bandwidth, or even capital. The same is undoubtedly true for website performance.
For developers, “contention” refers to when many website visitors are simultaneously competing for your application’s attention. In this blog – the third in a series about load testing – we’ll look at how you can try to catch a contention issue before it becomes a really big issue.
The idea of contention is that there’s a single resource that every request depends on. No matter how many servers you add to your application, there will always be a point where it has to pause, complete some work, and then free up all of the requests.
Contention is the hardest thing to catch in a load test, and probably the hardest thing to catch in Drupal, but it’s not impossible. With some diligence, you can stay on top of requests and not see your website’s performance suffer.
Consider when your caches need to be rebuilt internally. Surely, it’s best to not have a thousand people simultaneously visit your site and all of those cache entries have to be rebuilt all at once. Drupal will rebuild the cache of the first request, while having all the other requests pause. If that operation takes a hundred milliseconds, every single visitor’s request will pause for that exact same amount of time. To counter that, you can add more servers and resources, but it won’t make much of a difference. In fact, you’ll see that like with a lot of website launches, developers will add more resources and sit back and enjoy the show, only to stress when the inevitable contention issue arrives.
Now, contention issues are hard to track down, but it can be done. Thorough load testing can actually catch them by noticing arcs in results, indicating that response times suffer then recover in a short amount of time. This time to recover estimates the cost of relieving this contention. It all boils down to understanding the code, recognizing when contention happens and knowing when you can prevent it.
But don’t wait for that moment. If you’re conducting a load test, plug away and find the painful points of contention. You’ll thank yourself later.