Sal
akash "Akash Blog". min read

How to Max Out CPU Utilization on Ubuntu Server for Load Testing

If you’re looking to simulate high CPU usage for load testing or monitoring purposes on an Ubuntu Server, you can use the stress tool. Below is a streamlined, beginner-friendly guide to help you set this up with live CPU monitoring in your terminal.

Step-by-Step Guide

1. Update Server Packages

Begin by updating your package list to ensure you get the latest versions:

sudo apt-get update

2. Install the 'stress' Tool

Install the stress utility, which is specifically designed for load testing:

sudo apt-get install stress

3. (Optional but Recommended) Use tmux for Persistent Sessions

If you want to monitor your load and keep the session running even after disconnecting, start a tmux session:

tmux

4. Monitor CPU Utilization

Open the system monitoring dashboard using the top command. This will help you visualize CPU usage in real time:

top

5. Start CPU Load Test

In a new terminal window (or tmux pane), run the following command to increase CPU utilization (replace 5 with the number of CPU cores you want to stress):

stress -c 5

This command will fully utilize five CPU cores, effectively pushing overall CPU usage toward 100% (depending on your server’s core count).

Tips

Adjust the -c flag to match the number of CPU cores you want to stress.

Use Ctrl+C to stop the stress test at any time.

Combine this setup with monitoring tools like htop or your cloud provider’s resource dashboard for deeper insights.

This approach is ideal for testing performance, stability, or auto-scaling behavior in a safe and controlled environment.

  Never miss a story from us, get weekly updates in your inbox.