Pre-release Load Testing for Web Services: k6, Scenarios, and SLO
Load testing web services before release: using k6, building scenarios, and verifying SLO. Recommendations from ESK Solutions.Before launching a web service, each team aims to ensure smooth operation even under high load. A sudden influx of users can result in slow loading, errors, and customer loss. To avoid this, load testing has long been standard practice in the industry. At ESK Solutions, load testing is an integral part of web development, and we use modern tools like k6 to simulate real-world usage scenarios.
Why Load Testing Is Critical Before Release
Without load testing, there is no guarantee that a web service will withstand real user activity. Even a carefully designed architecture can fail under unexpected traffic. Key risks:
- performance degradation and increased response time;
- partial or complete service unavailability;
- cascading failures in a microservice environment;
- loss of revenue and reputation.
Load testing addresses these issues: it identifies bottlenecks, verifies scaling capabilities, and confirms compliance with target indicators (SLO). This is especially important for SaaS products: in our practice of SaaS application development, we simulate the concurrent operation of hundreds of tenants to ensure resource isolation is not compromised under load.
Modern Tooling: Why k6 Changes the Game
Traditional tools like JMeter are gradually giving way to lighter, more flexible solutions. k6 from Grafana Labs is a leader in load testing. Its key advantages:
- writing tests in JavaScript with an intuitive API;
- high performance and low resource consumption;
- support for scenarios of any complexity (ramp-up, spike, stress, soak);
- native integration with Grafana and cloud monitoring services;
- ability to set thresholds for automatic test pass/fail.
When designing cloud services, we use k6 to simulate geographically distributed load and verify infrastructure elasticity. Scenarios allow loading REST API, WebSocket, and gRPC endpoints, covering virtually any modern stack.
Developing Load Test Scenarios: From Simple to Complex
An effective load test starts with proper modeling of user behavior. In k6, scenarios are defined via the options object, where you can specify the load profile (stages), types of virtual users, and test duration. Main scenario types:
- Smoke test (minimal load check) — ensures the system starts and handles basic requests without errors.
- Load test (standard load) — simulates expected peak activity, e.g., 100 concurrent users for 10 minutes.
- Stress test (finding breaking point) — gradually increases load until service degradation to determine the breaking point.
- Spike test (sudden surge) — rapid increase to extreme values, such as from a sudden marketing influx.
- Soak test (endurance test) — checks stability and absence of memory leaks over extended periods (hours or days).
For enterprise systems like corporate intranet portals, we model scenarios accounting for work schedules: morning peak activity, lunchtime lull, and evening decline. For CRM solutions we also build (CRM development), tests include intensive transactions and reports that generate heavy database load.
SLO as a Benchmark for Result Acceptability
SLO (Service Level Objective) are measurable target indicators of service quality agreed upon with the client or business. Typical metrics:
- Latency: p95, p99 — response time for 95% or 99% of requests. For example, API should respond within 200 ms in 95% of cases.
- Availability: percentage of successful requests over a period (typically 99.9% or higher).
In k6, SLOs are turned into thresholds that are automatically checked at the end of the test. Example configuration:
export let options = { thresholds: { http_req_duration: ['p(95)<200', 'p(99)<500'], // latency http_req_failed: ['rate<0.01'], // errors <1% }, };If the actual p95 exceeds 200 ms, the test will be marked as failed. This allows integrating SLO checks directly into the CI/CD pipeline. Our specialists in web development, together with clients, set such target metrics during the design phase so that load tests give a clear answer — whether the service is ready for launch.
Integrating Load Testing into CI/CD and Automation
Modern DevOps practices require load testing to be part of the continuous delivery pipeline. k6 integrates easily into Jenkins, GitLab CI, GitHub Actions, and other systems. Workflow:
- A k6 script is automatically run when a new version is built.
- The scenario defines SLO thresholds and a baseline load (for example, a regression smoke test).
- If thresholds are violated, the pipeline stops with a notification to the team.
- Results are sent to Grafana for visualization and trend analysis.
For critical services, we recommend not only tests on the staging environment but also safe tests on production using gradual traffic increase (canary deployments). This allows checking real performance without risk to all users. Load testing in CI/CD is one of the key aspects we implement during web service development to ensure their reliability from day one after release.
Frequently Asked Questions
Can manual load testing be completely replaced by automated scripts?
k6 scripts cover almost all typical scenarios: simulating multiple users, checking the failure point, and long-running tests. Manual intervention may be required for very specific user paths, but in 90% of cases automation is sufficient. Our experience in SaaS development confirms that automated tests successfully replace manual ones if scenarios are carefully designed.
How often should load testing be performed?
It is recommended to run tests with every significant code change that could affect performance — query optimization, adding new services, infrastructure updates. In a CI/CD pipeline, it’s enough to include a lightweight smoke test per commit, and full scenarios when preparing a release or once per sprint.
Why is k6 better than JMeter?
k6 is a more modern solution: tests are written in JavaScript rather than through a bulky GUI; it consumes fewer resources, integrates more easily with CI/CD systems and Grafana; supports more flexible scenario configuration using scripts and executors. JMeter remains relevant for legacy projects, but for new web services we at ESK Solutions choose k6.
Which SLO metrics are most important for a commercial web service?
Priority is response time at the 95th and 99th percentiles (p95, p99), as they reflect the experience of most users and the “worst acceptable” cases respectively. The second most important metric is the error rate (usually no more than 0.1–1%). Throughput is important but is often a derivative of architecture scaling. We set all these metrics as thresholds during web service development.
Do you need to perform load testing in the production environment?
Yes, because test environments rarely fully replicate production: server configurations, network latency, and data volume differ. A safe approach is a “canary” launch, where load is first applied to a small fraction of users or through gradual traffic increase. This way we can catch issues without affecting all customers.


