ApacheBench

Load Testing with ApacheBench (ab) on Arch Linux: A Quick Start Guide

If you’re managing web applications or APIs, performance testing is essential. One of the simplest yet effective tools for quick benchmarking is ApacheBench (ab) — a command-line utility that comes with Apache HTTP server. In this guide, we’ll show you how to install and use ApacheBench on Arch Linux to run basic load tests.


⚙️ What Is ApacheBench?

ApacheBench (ab) is a lightweight benchmarking tool used to measure how many requests per second your web server can handle. It simulates concurrent connections and provides performance statistics like:

  • Requests per second
  • Connection times
  • Failed requests
  • Throughput

It’s especially useful during early development or post-deployment testing to identify bottlenecks.


✅ Prerequisites

  • A system running Arch Linux or derivative (e.g. Manjaro)
  • Access to a terminal with sudo privileges
  • A running web server or endpoint to test (e.g., http://localhost/)

Step 1: Install ApacheBench on Arch Linux

On Arch Linux, ab is part of the apache package. Install it using pacman:

bashCopyEditsudo pacman -S apache

After installation, verify the binary:

bashCopyEditab -V

You should see output similar to:

csharpCopyEditThis is ApacheBench, Version 2.3 <...>

⚠️ Note: You don’t need to start Apache service if you only want to use ab.


Step 2: Basic ApacheBench Usage

To run a simple test with 100 requests and 10 concurrent connections:

bashCopyEditab -n 100 -c 10 http://localhost/

Where:

  • -n 100 = total number of requests to perform
  • -c 10 = number of multiple requests to make at a time

Step 3: Read the Output

Sample output:

yamlCopyEditConcurrency Level:      10
Time taken for tests:   0.732 seconds
Complete requests:      100
Failed requests:        0
Requests per second:    136.56 [#/sec] (mean)
Time per request:       73.2 [ms] (mean)

Key metrics to monitor:

  • Requests per second: Indicates server capacity
  • Time per request: Average latency
  • Failed requests: Must be zero or minimal

Step 4: Test Against Remote URLs

You can also test public or remote servers:

bashCopyEditab -n 500 -c 50 https://yourdomain.com/api/endpoint

⚠️ Be responsible — always get permission before load testing external or production services.


Step 5: Advanced Options

ApacheBench supports several advanced flags:

  • -p postfile – send POST data
  • -T content-type – set content type for POST
  • -H header – add custom headers (e.g., auth tokens)
  • -e csvfile.csv – output results in CSV format

Example:

bashCopyEditab -n 200 -c 20 -p payload.json -T application/json -H "Authorization: Bearer TOKEN" https://api.example.com/data

🧪 Tips for Realistic Testing

  • Run tests from different geographic regions (use VPS)
  • Monitor system metrics during tests (CPU, RAM, network)
  • Combine with tools like htop, iftop, or Grafana

🔐 Security Reminder

Avoid overloading production servers during peak hours. If unsure, start with a small number of requests and scale up gradually.


Summary

ApacheBench is a great starting point for developers and sysadmins looking to benchmark their web applications. On Arch Linux, installation is fast and usage is straightforward — making it ideal for lightweight, quick testing workflows.


Need Hosting That Handles Traffic?

At GreenHost, we offer fast, scalable, and eco-friendly Linux hosting built to withstand real-world traffic. Talk to us about load testing, optimization, and auto-scaling options for your apps.