Operations 4 min read

Master ApacheBench: Quick Load Testing for Your Web Server in One Command

This guide explains what load testing is, how to use ApacheBench (ab) with simple commands, interprets the key performance metrics it returns, and highlights important precautions for effective and safe web server stress testing.

360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
Master ApacheBench: Quick Load Testing for Your Web Server in One Command

1. What is Load Testing

Load testing evaluates a system's ability to handle a large number of concurrent requests, identifying bottlenecks and when response times degrade or failures occur. It is essential for ensuring performance and reliability.

2. How to Use ab

ApacheBench (ab) is a lightweight tool that comes with Apache. After installing Apache, the ab executable is located in the bin directory. The basic syntax is:

./ab [options] url

Commonly used options are -c for concurrency (number of simultaneous requests) and -n for the total number of requests. For example, to send 100 requests with a concurrency of 10 to www.test.cn :

./ab -n 100 -c 10 www.test.cn

3. Result Analysis

The output includes several key metrics:

Requests per second: average number of requests handled per second.

Time per request: average time taken for each request.

Transfer rate: average data transferred per second.

4. Precautions

Do not exceed 1024 concurrent connections; the OS limits open file descriptors per process.

The total number of requests ( -n ) should not exceed 50000.

5. Summary

With a single command you can perform basic load testing using ab . The tool works for both Apache and Nginx, allowing you to compare server performance and choose the appropriate solution.

Performanceload testingweb serverab commandApacheBench
360 Zhihui Cloud Developer
Written by

360 Zhihui Cloud Developer

360 Zhihui Cloud is an enterprise open service platform that aims to "aggregate data value and empower an intelligent future," leveraging 360's extensive product and technology resources to deliver platform services to customers.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.