I'm currently trying to load test single page applications (SPAs) and it's turning out to be quite challenging. I'm using tools like Puppeteer and Selenium, which can handle around 5,000 concurrent sessions, but the results seem unrealistic. They do not capture user behavior like mouse movements or scrolling, and hydration times appear off by about 40%. It's clear the performance metrics are not aligning with actual user experiences.
I also experimented with Playwright in headful mode for 500 sessions, but it crashed with high CPU and memory usage. Other tools like k6 in browser mode were similarly ineffective, leading to unstable baselines and lackluster user simulations. I'm really looking for advice from QA teams who have experience in large-scale load testing for SPAs, particularly on how to emulate thousands of real users during these tests.
5 Answers
Full-scale headless browsers struggle to accurately replicate thousands of real user interactions. A better strategy is to mix your methodology: use Puppeteer or Playwright for a handful of human-like sessions to add realism, while employing API-level testing tools like k6 or Locust for the bulk of your load testing. Distributing the load across multiple machines and introducing small variations in recorded user flows will help accomplish more realistic metrics.
Why simulate mouse movements or clicks at all? That approach isn't necessary since it's mostly about the server-side performance. Instead, load testing the backend by sending a high volume of requests can give you better insights.
Have you considered synthetic monitoring from real edge locations? Instead of overwhelming your infrastructure with simulated users, it might be better to test the API layer separately where the metrics are more relevant. This way, you can achieve a more genuine understanding of performance.
Stick with k6, but avoid using it in browser mode. Focus on real user metrics, such as HTTP requests per second, to align with actual concurrent users. This helps determine the user-to-workload ratio. In k6, try to replicate the same backend requests that the real users would make, ensuring that your simulated users match the load of actual users. Mimicking 5,000 browser sessions can be resource-intensive, so concentrate on the server-side traffic instead.
When testing SPAs, remember that thousands of real users are operating from thousands of browsers, each with their own interactions. Therefore, it’s more effective to focus on testing the backend of the application rather than simulating all the clicks and mouse movements that users would perform. You might want to consider simulating API requests which more closely represent real-world usage.

Related Questions
How to Build a Custom GPT Journalist That Posts Directly to WordPress
Cloudflare Origin SSL Certificate Setup Guide
How To Effectively Monetize A Site With Ads