|
| 1 | +--- |
| 2 | +title: NGINX Benchmarking |
| 3 | +weight: 6 |
| 4 | + |
| 5 | +### FIXED, DO NOT MODIFY |
| 6 | +layout: learningpathall |
| 7 | +--- |
| 8 | + |
| 9 | +## NGINX Benchmarking by ApacheBench |
| 10 | + |
| 11 | +**ApacheBench (ab)** is a lightweight command-line tool for benchmarking HTTP servers. It measures performance metrics like requests per second, response time, and throughput under concurrent load. |
| 12 | + |
| 13 | + |
| 14 | +1. Install ApacheBench |
| 15 | + |
| 16 | +On **Ubuntu Pro 24.04 LTS**, ApacheBench is available as part of the `apache2-utils` package: |
| 17 | +```console |
| 18 | +sudo apt update |
| 19 | +sudo apt install apache2-utils -y |
| 20 | +``` |
| 21 | + |
| 22 | +2. Verify Installation |
| 23 | + |
| 24 | +```console |
| 25 | +ab -V |
| 26 | +``` |
| 27 | +You should see an output similar to: |
| 28 | + |
| 29 | +```output |
| 30 | +This is ApacheBench, Version 2.3 <$Revision: 1923142 $> |
| 31 | +Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ |
| 32 | +Licensed to The Apache Software Foundation, http://www.apache.org/ |
| 33 | +``` |
| 34 | + |
| 35 | +3. Basic Benchmark Command Syntax |
| 36 | + |
| 37 | +```console |
| 38 | +ab -n <total_requests> -c <concurrent_clients> <http://host:port/path> |
| 39 | +``` |
| 40 | +Example: |
| 41 | + |
| 42 | +```console |
| 43 | +ab -n 1000 -c 50 http://localhost/ |
| 44 | +``` |
| 45 | +This sends **1000 total requests** with **50 concurrent connections** to `http://localhost/`. |
| 46 | + |
| 47 | +You should see an output similar to: |
| 48 | +```output |
| 49 | +This is ApacheBench, Version 2.3 <$Revision: 1903618 $> |
| 50 | +Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ |
| 51 | +Licensed to The Apache Software Foundation, http://www.apache.org/ |
| 52 | +
|
| 53 | +Benchmarking localhost (be patient) |
| 54 | +Completed 100 requests |
| 55 | +Completed 200 requests |
| 56 | +Completed 300 requests |
| 57 | +Completed 400 requests |
| 58 | +Completed 500 requests |
| 59 | +Completed 600 requests |
| 60 | +Completed 700 requests |
| 61 | +Completed 800 requests |
| 62 | +Completed 900 requests |
| 63 | +Completed 1000 requests |
| 64 | +Finished 1000 requests |
| 65 | +
|
| 66 | +
|
| 67 | +Server Software: nginx/1.24.0 |
| 68 | +Server Hostname: localhost |
| 69 | +Server Port: 80 |
| 70 | +
|
| 71 | +Document Path: / |
| 72 | +Document Length: 890 bytes |
| 73 | +
|
| 74 | +Concurrency Level: 50 |
| 75 | +Time taken for tests: 0.032 seconds |
| 76 | +Complete requests: 1000 |
| 77 | +Failed requests: 0 |
| 78 | +Total transferred: 1132000 bytes |
| 79 | +HTML transferred: 890000 bytes |
| 80 | +Requests per second: 31523.86 [#/sec] (mean) |
| 81 | +Time per request: 1.586 [ms] (mean) |
| 82 | +Time per request: 0.032 [ms] (mean, across all concurrent requests) |
| 83 | +Transfer rate: 34848.65 [Kbytes/sec] received |
| 84 | +
|
| 85 | +Connection Times (ms) |
| 86 | + min mean[+/-sd] median max |
| 87 | +Connect: 0 1 0.1 1 1 |
| 88 | +Processing: 0 1 0.1 1 1 |
| 89 | +Waiting: 0 1 0.2 1 1 |
| 90 | +Total: 1 2 0.1 2 2 |
| 91 | +
|
| 92 | +Percentage of the requests served within a certain time (ms) |
| 93 | + 50% 2 |
| 94 | + 66% 2 |
| 95 | + 75% 2 |
| 96 | + 80% 2 |
| 97 | + 90% 2 |
| 98 | + 95% 2 |
| 99 | + 98% 2 |
| 100 | + 99% 2 |
| 101 | + 100% 2 (longest request) |
| 102 | +``` |
| 103 | + |
| 104 | +### Benchmark Results Table Explained: |
| 105 | + |
| 106 | +- **Requests per second** – How many requests were served per second. |
| 107 | +- **Time per request** – Average latency per request. |
| 108 | +- **Transfer rate** – Data throughput. |
| 109 | +- **Connection times** – Breakdown of min/mean/max connect, processing, and total times. |
| 110 | +- **Percentage served** – Percentile distribution of response times. |
| 111 | + |
| 112 | +### Benchmark summary on x86_64: |
| 113 | +Here is a summary of the benchmark results collected on x86_64 **D4s_v6 Ubuntu Pro 24.04 LTS virtual machine**. |
| 114 | + |
| 115 | +| **Category** | **Metric** | **Value** | |
| 116 | +|---------------------------|-------------------------------------------------|-------------------------------| |
| 117 | +| **General Info** | Server Software | nginx/1.24.0 | |
| 118 | +| | Server Hostname | localhost | |
| 119 | +| | Server Port | 80 | |
| 120 | +| | Document Path | / | |
| 121 | +| | Document Length | 615 bytes | |
| 122 | +| **Test Setup** | Concurrency Level | 50 | |
| 123 | +| | Time Taken for Tests | 0.038 sec | |
| 124 | +| | Complete Requests | 1000 | |
| 125 | +| | Failed Requests | 0 | |
| 126 | +| **Transfer Stats** | Total Transferred | 857,000 bytes | |
| 127 | +| | HTML Transferred | 615,000 bytes | |
| 128 | +| | Requests per Second | 26,592.21 [#/sec] | |
| 129 | +| | Time per Request (mean) | 1.880 ms | |
| 130 | +| | Time per Request (across all) | 0.038 ms | |
| 131 | +| | Transfer Rate | 22,255.39 KB/sec | |
| 132 | +| **Connection Times (ms)** | Connect (min / mean / stdev / median / max) | 0 / 1 / 0.2 / 1 / 1 | |
| 133 | +| | Processing (min / mean / stdev / median / max) | 0 / 1 / 0.2 / 1 / 2 | |
| 134 | +| | Waiting (min / mean / stdev / median / max) | 0 / 1 / 0.2 / 1 / 1 | |
| 135 | +| | Total (min / mean / stdev / median / max) | 1 / 2 / 0.2 / 2 / 2 | |
| 136 | +| **Latency Percentiles** | 50% of requests served within | 2 ms | |
| 137 | +| | 66% of requests served within | 2 ms | |
| 138 | +| | 75% of requests served within | 2 ms | |
| 139 | +| | 80% of requests served within | 2 ms | |
| 140 | +| | 90% of requests served within | 2 ms | |
| 141 | +| | 95% of requests served within | 2 ms | |
| 142 | +| | 98% of requests served within | 2 ms |
| 143 | + |
| 144 | +### Benchmark summary on Arm64: |
| 145 | +Here is a summary of benchmark results collected on an Arm64 **D4ps_v6 Ubuntu Pro 24.04 LTS virtual machine**. |
| 146 | + |
| 147 | +| **Category** | **Metric** | **Value** | |
| 148 | +|---------------------------|-------------------------------------------------|-------------------------------| |
| 149 | +| **General Info** | Server Software | nginx/1.24.0 | |
| 150 | +| | Server Hostname | localhost | |
| 151 | +| | Server Port | 80 | |
| 152 | +| | Document Path | / | |
| 153 | +| | Document Length | 890 bytes | |
| 154 | +| **Test Setup** | Concurrency Level | 50 | |
| 155 | +| | Time Taken for Tests | 0.032 sec | |
| 156 | +| | Complete Requests | 1000 | |
| 157 | +| | Failed Requests | 0 | |
| 158 | +| **Transfer Stats** | Total Transferred | 1,132,000 bytes | |
| 159 | +| | HTML Transferred | 890,000 bytes | |
| 160 | +| | Requests per Second | 31,523.86 [#/sec] | |
| 161 | +| | Time per Request (mean) | 1.586 ms | |
| 162 | +| | Time per Request (across all) | 0.032 ms | |
| 163 | +| | Transfer Rate | 34,848.65 KB/sec | |
| 164 | +| **Connection Times (ms)** | Connect (min / mean / stdev / median / max) | 0 / 1 / 0.1 / 1 / 1 | |
| 165 | +| | Processing (min / mean / stdev / median / max) | 0 / 1 / 0.1 / 1 / 1 | |
| 166 | +| | Waiting (min / mean / stdev / median / max) | 0 / 1 / 0.2 / 1 / 1 | |
| 167 | +| | Total (min / mean / stdev / median / max) | 1 / 2 / 0.1 / 2 / 2 | |
| 168 | + |
| 169 | +### Highlights from Ubuntu Pro 24.04 LTS Arm64 Benchmarking |
| 170 | + |
| 171 | +When comparing the results on Arm64 vs x86_64 virtual machines: |
| 172 | + |
| 173 | +- Achieved **31,523.86 requests/sec**, demonstrating high throughput under concurrent load. |
| 174 | +- Response time per request averaged **1.586 ms**, indicating efficient handling of requests with minimal delay. |
| 175 | +- **Zero failed requests**, confirming stability and reliability during testing. |
| 176 | +- Consistently low **connection and processing times** (mean ≈ 1 ms), ensuring smooth performance. |
| 177 | + |
| 178 | +You have now benchmarked NGINX on an Azure Cobalt 100 Arm64 virtual machine and compared results with x86_64. |
0 commit comments