Simulating high traffic

 

Overview

This article explains how to use the ab benchmarking tool on your VPS to simulate high traffic.

Prerequisites

To run the commands in this article, you must have a Shell user configured in your panel and general knowledge of the UNIX Shell.

What does a benchmarking tool do?

If you find your VPS memory usage spikes at certain times of the day, you can use a benchmarking tool to simulate a high-traffic environment. Once running, you can then check memory processes to determine the cause of the problem.

Using the Apache HTTP server benchmarking tool

To use the ab command tool, log in to your server via SSH and run the following command:

[server]$ ab -n 1000 -c 20 https://www.example.com/index.html

This command creates 1000 connections to https://www.example.com/index.html, limiting itself to 20 concurrent connections.

Viewing your processes while testing

While the ab command is running, open two more tabs in your terminal to observe server processes:

  • In the first tab, run top -c. Then, sort by memory (Shift + M).
  • In the second tab, run free -m (or watch free -m).

These commands are effective at profiling your sites and checking to see if caching is working. You can repeat this process for each of your domains to see which ones are most affecting your memory usage so you know where to optimize.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?