How to Migrate cPanel Accounts Between Servers Using WHM Transfer Tool (Zero-Downtime Guide) Moving live…
VPS Load Testing: Safely Test Your Server’s Performance

VPS load testing helps you understand how a virtual private server performs when multiple users or requests access an application simultaneously. A properly designed load test can reveal slow endpoints, CPU bottlenecks, memory pressure, database limitations, and connection-handling problems before they affect real users.
However, running a load test without appropriate limits can create the very problems you are trying to prevent. Excessive concurrency can exhaust PHP workers, overload a database, fill connection queues, or consume the available CPU and memory on a production VPS.
The goal is not simply to generate as many requests as possible. It is to measure application performance under a controlled workload while keeping the server stable.
In this guide, you will learn how to use wrk, hey, and ApacheBench (ab), choose appropriate concurrency levels, monitor system resources, interpret test results, and establish practical safety limits for production environments.
What Is VPS Load Testing?
VPS load testing is the process of sending a controlled volume of requests to an application hosted on a virtual private server to evaluate how it behaves under expected or increased demand.
For example, a website may perform well when one person visits it but become noticeably slower when dozens of requests arrive simultaneously. A load test helps identify the point at which response times begin increasing, errors appear, or server resources become constrained.
Common objectives include:
- Measuring HTTP requests per second.
- Understanding response-time behavior under concurrency.
- Identifying CPU, memory, storage, and network bottlenecks.
- Checking whether application workers or database connections become exhausted.
- Comparing application performance before and after optimization.
- Estimating safe operating capacity under a representative workload.
Load testing is different from simply checking whether a website responds. A successful HTTP request confirms basic availability, but it does not establish how reliably the application performs under sustained traffic.
It is also important to distinguish load testing from stress testing. Load testing evaluates a defined workload, often based on expected traffic. Stress testing deliberately pushes a system beyond its expected operating conditions to investigate its limits. Stress testing a live production server without a controlled plan is particularly risky.
Before You Start: Establish a Safe Testing Environment
Before generating traffic, decide exactly what you want to measure and which system will receive the requests.
1. Test only systems you control or have permission to test
Use your own VPS, an authorized staging environment, or a service for which you have explicit testing approval.
If the application is behind a CDN, reverse proxy, web application firewall, or load balancer, understand which component receives the requests. A test against the public domain may primarily measure the CDN cache rather than the origin VPS.
2. Prefer staging for aggressive tests
A staging environment that resembles production is usually the safest place to increase concurrency or explore capacity limits.
If you must test production, begin with a small workload during an approved maintenance or low-traffic window. Inform relevant stakeholders, monitor the service continuously, and prepare a stop procedure.
Avoid testing checkout flows, payment gateways, email-sending endpoints, password-reset operations, or other actions that could create real transactions or external side effects. Use isolated test data and disable unnecessary integrations where possible.
3. Record a baseline
Before the test, record the server’s normal resource usage and application response times.
Useful commands include:
uptime
free -h
df -h
vmstat 1
For CPU and process activity, use:
top
If installed, htop provides an interactive view of CPU, memory, and processes. Use iostat -xz 1 to examine storage activity when the sysstat package is available.
Record the normal HTTP response time, CPU utilization, memory availability, disk activity, and database load. Without a baseline, it is difficult to determine whether the test caused a problem or simply coincided with existing activity.
4. Set explicit stop conditions
Decide in advance when the test must stop. Reasonable signals include:
- Application error rates increasing above an agreed threshold.
- Response times exceeding the service’s latency target.
- CPU remaining near saturation.
- Memory pressure, sustained swapping, or an out-of-memory event.
- Database connection exhaustion or rapidly growing query queues.
- Disk latency or network utilization reaching an operational limit.
- Real users reporting degraded service.
There is no universal CPU percentage or concurrency value that is safe for every VPS. The appropriate limits depend on the workload, baseline traffic, available headroom, and application requirements.
Choose the Right Load-Testing Tool
Three command-line tools are useful for straightforward HTTP benchmarks: wrk, hey, and ApacheBench.
| Tool | Best use | Important controls |
|---|---|---|
wrk |
Multithreaded HTTP benchmarking | Threads, connections, duration |
hey |
Simple, controlled HTTP load generation | Request count, concurrency, duration, rate limiting |
ab |
Basic HTTP benchmarking and compatibility tests | Request count, concurrency, time limit, keep-alive |
All three can generate meaningful traffic. None automatically guarantees that a test is safe for production. The workload parameters matter more than the tool’s name.
Install or verify the tools
Check whether ApacheBench is installed:
ab -V
Check wrk:
wrk --version
Check hey:
hey -h
Installation methods vary by operating system. Use your distribution’s package manager or the project’s official installation instructions.
Official references:
How to Use wrk for VPS Load Testing
wrk is a multithreaded HTTP benchmarking tool designed to generate substantial request volumes. It can be useful when you need to examine how an HTTP endpoint behaves with multiple concurrent connections.
Because wrk can generate significant traffic from a single machine, start with conservative parameters.
Start with a short, low-concurrency test
Use a lightweight endpoint on your own server or an authorized test environment:
wrk -t1 -c5 -d10s --latency https://staging.example.com/
Replace the example hostname with your actual authorized test endpoint.
The options mean:
-t1: use one load-generator thread.-c5: maintain five HTTP connections.-d10s: run the test for ten seconds.--latency: display additional latency statistics.
This is a starting point, not a guarantee of safety. Even five connections can be expensive if every request triggers a costly database query or external API call.
Increase the workload gradually
If the first run completes successfully and monitoring shows sufficient headroom, repeat the test with a slightly larger workload:
wrk -t1 -c10 -d15s --latency https://staging.example.com/
Then, if the results remain stable:
wrk -t2 -c20 -d20s --latency https://staging.example.com/
Do not automatically continue increasing concurrency just because the previous command completed. Review the latency, error behavior, and server metrics after every run.
The goal is to identify the point where performance starts to deteriorate, not to force the server into failure.
Understand the output
Depending on the version and run, wrk can report latency statistics, request rates, total requests, and data-transfer rates.
Pay attention to:
- Latency: how long requests take.
- Requests/sec: achieved request throughput.
- Transfer/sec: the rate at which response data is transferred.
- Errors and timeouts: whether requests are failing or exceeding the configured timeout.
A high requests-per-second result does not necessarily indicate a healthy application. If latency rises sharply or requests start timing out, the workload may have exceeded a useful operating level.
Also consider the load generator itself. If the machine running wrk reaches CPU or network limits, the reported throughput may reflect the client rather than the VPS being tested.
How to Use hey for Controlled Testing
hey is a convenient HTTP load generator that supports fixed request counts, concurrency, timed runs, and rate limiting.
Its rate-limiting options are particularly useful when you want to increase traffic gradually rather than allow the tool to generate requests as quickly as possible.
Run a small test with a fixed request count
hey -n 100 -c 5 https://staging.example.com/
This sends 100 total requests with up to five concurrent workers.
The options are:
-n 100: send 100 requests in total.-c 5: use five concurrent workers.
This is a useful initial check, but it may finish too quickly to reveal behavior under sustained load.
Run a short, duration-based test
hey -z 15s -c 5 https://staging.example.com/
This runs for approximately 15 seconds with five concurrent workers.
Apply a request-rate limit
hey -z 30s -c 2 -q 2 https://staging.example.com/
Here, -q 2 limits each worker to approximately two queries per second. With two workers, the configured aggregate target is approximately four requests per second, subject to implementation details and actual response timing.
This is a rate-limited test, not a guarantee that exactly four requests will be completed every second.
For production, begin with a deliberately low rate. Increase it only after checking that the application remains healthy.
The hey output includes request statistics and latency information. Where appropriate, use its CSV output option to preserve results for later comparison.
How to Use ApacheBench (ab)
ApacheBench is a long-established HTTP benchmarking tool distributed with Apache HTTP Server packages on many systems.
It is useful for basic tests, particularly when you want to control the total number of requests and concurrent requests.
Run a conservative benchmark
ab -n 100 -c 5 https://staging.example.com/
This sends 100 requests with a concurrency level of five.
For a test that reuses persistent connections, you can add the keep-alive option:
ab -n 200 -c 5 -k https://staging.example.com/
The -k flag enables HTTP keep-alive. Without it, ApacheBench does not enable persistent connections by default.
This difference matters when comparing results. Connection reuse changes the workload, so keep-alive and non-keep-alive results should not be treated as directly equivalent.
Understand ApacheBench’s output
Important fields include:
- Concurrency Level: the configured number of concurrent requests.
- Time taken for tests: the total time required to complete the run.
- Complete requests: requests completed by the benchmark.
- Failed requests: requests that failed according to the tool’s reporting.
- Requests per second: the achieved average throughput.
- Time per request: a timing statistic whose interpretation depends on the output field.
- Transfer rate: the amount of response data transferred per unit of time.
Review the complete output rather than focusing on requests per second alone. Also inspect the HTTP status codes and application logs, because a benchmark can return responses that are fast but incorrect, such as redirects, authorization errors, or application-level failures.
For additional details, consult the official ApacheBench manual.
Concurrency vs Requests Per Second
Concurrency and request rate are related, but they describe different things.
Concurrency represents how many requests or connections are active at the same time, according to the load generator’s model.
Requests per second (RPS) represents how many requests are completed per second.
Consider a test with ten concurrent workers. If each request takes a long time to complete, the application may achieve a low request rate despite having ten active workers. If requests complete quickly, the same concurrency may produce a much higher rate.
This is why simply setting a high concurrency value is not a reliable way to simulate realistic traffic.
Why excessive concurrency is dangerous
A request may consume several resources during processing:
- A PHP-FPM worker or application thread.
- A database connection.
- CPU time for application logic.
- Memory for request data and intermediate objects.
- Network and file descriptors.
- Additional connections to Redis or external services.
If a VPS has a limited number of application workers, excessive concurrency can create queues and increase response times. A database-heavy request can become expensive even when CPU utilization initially appears moderate.
A useful approach is to start with low concurrency, observe the behavior, and increase it in small steps. For example, a test sequence might use 1, 2, 5, and 10 concurrent workers. These are example increments, not universally safe limits.
Stop increasing the load when the application’s latency or error rate crosses the predefined threshold, or when resource pressure begins to threaten production stability.
Which Metrics Should You Monitor?
A reliable load test combines client-side results with server-side monitoring.
Google’s Site Reliability Engineering guidance describes four important service signals: latency, traffic, errors, and saturation. These provide a useful framework for interpreting load-test results. See Monitoring Distributed Systems.
1. Response time and latency percentiles
Average latency is useful, but it can hide slow requests.
Suppose most requests complete quickly while a small percentage take several seconds. The average may look acceptable even though some users experience serious delays.
Where available, examine:
- p50: the median response time.
- p95: the response time at or below which approximately 95% of measured requests fall.
- p99: the response time at or below which approximately 99% of measured requests fall.
The exact percentile interpretation depends on the tool’s reporting method and sample size. Short tests with few requests may not provide stable p95 or p99 estimates.
2. Throughput
Throughput measures the number of completed requests per second.
Increasing throughput is generally useful only while the application continues to meet its latency and error targets. A higher request rate accompanied by severe latency increases may indicate that the server is approaching saturation.
3. Error rate
Monitor failed requests, HTTP 5xx responses, timeouts, connection errors, and relevant application exceptions.
Also check for HTTP 429 responses, which may indicate rate limiting. An error response can arrive quickly, so low latency alone does not mean the application is healthy.
4. CPU utilization and load
Use:
top
or:
vmstat 1
Review CPU utilization and whether the run queue grows as traffic increases.
On a virtualized server, CPU steal time can also matter. Significant steal time may indicate that the virtual CPU is waiting for physical CPU time from the virtualization host.
A high CPU reading is not automatically a failure, but sustained saturation combined with rising latency or errors is a warning.
5. Memory and swap
Check memory before and during the test:
free -h
Monitor available memory, swap activity, and signs of memory pressure. A workload that causes sustained swapping or triggers the out-of-memory killer can degrade the entire VPS.
6. Disk and database performance
Dynamic web applications may spend substantial time waiting for database queries or storage operations.
If available, use:
iostat -xz 1
Check database connection counts, slow queries, lock waits, query latency, and connection-pool exhaustion using the database’s own monitoring facilities.
A test that targets a PHP endpoint backed by MySQL or PostgreSQL is testing the application stack, not just the web server. The database may be the first component to become saturated.
7. Network utilization
Monitor incoming and outgoing traffic, retransmissions, connection errors, and interface limits where applicable.
Large responses can saturate the network before the CPU becomes a bottleneck. Conversely, a test running on the same VPS may avoid parts of the real network path and produce results that differ from those experienced by remote users.
A Safe Step-by-Step Load-Testing Procedure
Use the following workflow to make your tests repeatable and reduce the risk of an outage.
Step 1: Define the objective. Decide whether you are measuring a static file, cached page, uncached database query, API endpoint, or another operation. Write down the expected workload and the performance target.
Step 2: Verify the endpoint. Confirm that the URL is correct, returns the expected status, and does not trigger unintended changes. Use a staging endpoint whenever practical.
Step 3: Capture baseline metrics. Record normal response times, resource usage, error rates, and database activity before generating traffic.
Step 4: Run a small test. Start with a short duration and low concurrency. Check that the tool produces the expected responses.
Step 5: Increase one variable at a time. Raise concurrency or request rate gradually while keeping other conditions consistent. This makes it easier to understand why the results change.
Step 6: Monitor the entire stack. Watch the load generator, VPS, web server, application workers, database, cache, and any important upstream dependencies.
Step 7: Stop at the first meaningful warning. If latency rises beyond the agreed target, errors increase, or resource pressure approaches a dangerous level, stop the test instead of pushing further.
Step 8: Allow recovery. Confirm that latency and resource usage return to normal and that queues, database connections, and worker pools recover before starting another run.
Step 9: Repeat the same test. Use the same endpoint, payload, client location, concurrency, duration, and connection settings when comparing an optimization with the baseline.
Step 10: Document the result. Save the command, software versions, test time, configuration, response metrics, errors, and server observations. This creates a useful record for future capacity planning.
How to Interpret Load-Test Results
Imagine a hypothetical VPS benchmark produces the following results:
| Concurrent workers | Requests/sec | p95 latency | Errors |
|---|---|---|---|
| 1 | 18 | 70 ms | 0% |
| 5 | 72 | 95 ms | 0% |
| 10 | 110 | 180 ms | 0% |
| 20 | 118 | 750 ms | 2% |
These figures are illustrative, not real benchmark results.
Throughput increases as concurrency rises from one to ten workers. At twenty workers, throughput barely improves, while p95 latency increases sharply and errors appear.
That pattern suggests diminishing returns and possible saturation. The next step is to investigate which component is constrained, not to increase concurrency further.
Possible causes include a limited PHP-FPM worker pool, slow database queries, lock contention, CPU saturation, or connection limits. The metrics and logs should determine which explanation is most likely.
Common result patterns
Throughput increases while latency remains stable: The application may have additional capacity, although other metrics should still be checked.
Throughput plateaus while latency increases: The server may be approaching a bottleneck. Additional concurrent requests may be waiting in queues rather than increasing useful work.
Errors increase suddenly: Look for worker exhaustion, database failures, timeouts, connection limits, rate limiting, or resource exhaustion.
CPU stays low while requests become slow: Investigate database waits, external API latency, storage delays, network problems, locks, and application-level queues.
The client reports failures but the server looks healthy: The load generator or network path may be the bottleneck. Check client CPU, available network bandwidth, connection limits, and local resource exhaustion.
How to Choose Safe Limits for a Production VPS
There is no single concurrency value that is safe for every server. A small VPS serving cached static pages behaves very differently from a server executing complex PHP code and database queries.
Instead of selecting a universal limit, establish a safe operating envelope based on measured performance.
Define a maximum acceptable latency, an error-rate threshold, and resource headroom appropriate to your service. Start with a workload comfortably below the expected limit, then increase it only when monitoring confirms that the application remains stable.
For production systems, leave capacity for ordinary traffic, scheduled tasks, backups, monitoring, and unexpected demand. A benchmark that consumes all available capacity may produce a useful stress-test result, but it does not establish a healthy production operating point.
If your goal is to estimate capacity, the useful result is the highest repeatable workload that meets your service objectives with adequate safety margin—not the highest number of requests you can force through the server once.
Common Load-Testing Mistakes
Running the load generator on the target VPS
This consumes CPU, memory, network resources, and file descriptors that the application needs. When possible, run the benchmark from a separate machine with a network path representative of your users.
Testing only a cached static page
A static response may bypass PHP, the database, and other expensive application components. Include representative endpoints if you need to understand application capacity.
Increasing concurrency too quickly
Large jumps can overwhelm worker pools or databases before you understand the system’s behavior. Use small increments and review the metrics after every run.
Ignoring the CDN or reverse proxy
A CDN cache hit may measure edge performance rather than origin capacity. Document the path being tested and verify whether requests reach the origin.
Comparing inconsistent runs
Changes in cache state, TLS settings, response size, keep-alive behavior, authentication, or database contents can alter results. Keep test conditions consistent unless a particular difference is what you are investigating.
Focusing only on average latency
Average values can conceal slow outliers. Review percentiles, errors, and resource utilization together.
Testing destructive or side-effecting endpoints
Repeated POST requests can create duplicate records, trigger emails, initiate payments, or consume third-party API quotas. Use isolated test data and safe endpoints.
Final Thoughts
VPS load testing is most useful when it answers a specific operational question without putting production availability at unnecessary risk.
Tools such as wrk, hey, and ApacheBench make it straightforward to generate HTTP traffic, but the quality of the test depends on sensible limits, representative workloads, and careful monitoring.
Start with a baseline, use low concurrency, increase traffic gradually, and evaluate latency, throughput, errors, and resource saturation together. When results begin to deteriorate, investigate the bottleneck rather than simply increasing the load.
A repeatable test that identifies a real performance limit while keeping the service healthy is far more valuable than a benchmark that overwhelms the VPS without explaining why.
