ApacheBench (ab)
ApacheBench is a simple, command-line HTTP performance testing tool included in the apache2-utils package. It is lightweight and easy to use, making it suitable for quick checks of Nginx’s basic performance (e.g., requests per second, response time).
sudo apt install apache2-utils to install.ab -n 1000 -c 10 http://localhost/ (where -n is the total number of requests and -c is the concurrency level).wrk
wrk is a modern, high-performance HTTP benchmarking tool designed for high-concurrency scenarios. It leverages epoll (Linux) and kqueue (BSD) for efficient I/O and uses a multi-threaded model to generate significant load with minimal system resources.
build-essential libssl-dev git) and compile from source:sudo apt install build-essential libssl-dev git
git clone https://github.com/wg/wrk.git
cd wrk && make
sudo cp wrk /usr/local/bin/
wrk -t12 -c400 -d30s http://localhost/ (where -t is the number of threads, -c is the number of connections, and -d is the test duration).siege
siege is a flexible HTTP load testing tool that supports both basic and advanced scenarios (e.g., random URLs, POST requests). It simulates multiple users accessing the server concurrently and provides detailed statistics.
sudo apt install siege to install.siege -c100 -r10 http://localhost/ (where -c is the concurrency level and -r is the number of repetitions).Apache JMeter
Apache JMeter is a feature-rich, GUI-based tool for complex performance testing. It supports HTTP/HTTPS, dynamic content (e.g., PHP, databases), and distributed testing, making it ideal for simulating real-world user behavior.
./bin/jmeter to start the GUI.sysbench
While not an Nginx-specific tool, sysbench is useful for evaluating the underlying server performance that impacts Nginx (e.g., CPU, memory, disk I/O). Optimizing these components can significantly improve Nginx’s performance.
sudo apt install sysbench to install.sysbench cpu --threads=4 --events=10000 --time=60 runsysbench memory --threads=4 --time=60 runsysbench fileio --file-total-size=1G --file-test-mode=randrw --init-rng=1 --max-time=300 --max-requests=1000 run