Simulating high traffic

Overview

If your problem has to do with your memory usage spiking at certain times of the day, it can be difficult to figure out what's happening since things are often running well when you're able to check on them. When that's the case, it's important to be able to simulate the environment that's causing the problem.

A benchmark tool you can use to simulate traffic is the ab command. View the following link for further details:

To use, enter the following command:

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

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

Viewing your processes while testing

To observe what's going on, you'll likely want three terminal windows open.

  • In the first window, SSH to your server and run top -c. Then, sort by memory (Shift + M).
  • In the second window, run free -m (or, run watch free -m).
  • In the third window, run the ab command to simulate traffic. This is effective for profiling your sites and checking to see if caching is working, and you can run this for each of your domains and see which ones affect your memory usage the most 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?