У 2007 році ми перевіряли, як наш сервер titan-r витримує пікові навантаження. Для тестів використали сайт nerusoft.com на phpNuke під брендом RS™. Програма випробувань включала ApacheBench, http_load та Siege, а також спостереження за VSZ, RSS, CPU і використанням пам’яті.
Умови та журнал вимірювання
У плані були повторні запуски після перезапуску середовища й спостереження через ps aux. Окремі значення використання пам’яті тут не записані, тому за цим журналом можна оцінювати показники HTTP-тестів, але не робити кількісних висновків про витрати RAM. Нижче залишено повний вивід із командами.
===== Тестування за допомогою Apache Benchmark =====
# Вимірювання пам’яті (ps aux: VSZ "virtual set size" и RSS "resident set size").
# Тестування ApacheBenchmark (двічі поспіль)
root@titan-r:~# ab -c 5 -n 1000 http://nerusoft.com/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking nerusoft.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests
Server Software: nginx/0.4.13
Server Hostname: nerusoft.com
Server Port: 80
Document Path: /
Document Length: 94796 bytes
Concurrency Level: 5
Time taken for tests: 31.881701 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 95053000 bytes
HTML transferred: 94796000 bytes
Requests per second: 31.37 [#/sec] (mean)
Time per request: 159.409 [ms] (mean)
Time per request: 31.882 [ms] (mean, across all concurrent requests)
Transfer rate: 2911.54 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 109 158 37.3 153 313
Waiting: 107 156 37.1 150 310
Total: 109 158 37.3 153 313
Percentage of the requests served within a certain time (ms)
50% 153
66% 172
75% 185
80% 191
90% 208
95% 224
98% 249
99% 267
100% 313 (longest request)
=================================================
# Вимірювання пам’яті та використаного процесорного часу (ps aux: VSZ, RSS, %CPU, %MEM)
# Перезапуск фреймворку
# Тестування ApacheBenchmark (двічі поспіль)
ab -c 100 -n 10000 http://nerusoft.com/
root@titan-r:~# ab -c 100 -n 10000 http://nerusoft.com/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking nerusoft.com (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests
Server Software: nginx/0.4.13
Server Hostname: nerusoft.com
Server Port: 80
Document Path: /
Document Length: 94796 bytes
Concurrency Level: 100
Time taken for tests: 258.190002 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 950530000 bytes
HTML transferred: 947960000 bytes
Requests per second: 38.73 [#/sec] (mean)
Time per request: 2581.900 [ms] (mean)
Time per request: 25.819 [ms] (mean, across all concurrent requests)
Transfer rate: 3595.22 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 4
Processing: 199 2572 1352.8 2296 38015
Waiting: 196 2564 1350.7 2290 38012
Total: 203 2572 1352.8 2296 38015
Percentage of the requests served within a certain time (ms)
50% 2296
66% 2584
75% 2809
80% 2979
90% 3481
95% 3974
98% 4784
99% 6141
100% 38015 (longest request)
======= Тестування за допомогою http_load ===========
# Вимірювання пам’яті та використаного процесорного часу.
# Перезапуск фреймворку
# Вимірювання http_load
http_load -rate 10 -seconds 5 nerusoft.com
======== Тестування за допомогою siege ===========
# Вимірювання пам’яті та використаного процесорного часу.
# Перезапуск фреймворку
# Тест Siege з 50 одночасними користувачами протягом однієї хвилини.
siege -d1 -t1M -c50 nerusoft.com
root@titan-r:~# siege -d1 -t1M -c50 nerusoft.com
** siege 2.65b1
** Preparing 50 concurrent users for battle.
The server is now under siege...
Lifting the server siege... done.
Transactions: 2312 hits
Availability: 100.00 %
Elapsed time: 60.57 secs
Data transferred: 209.03 MB
Response time: 0.79 secs
Transaction rate: 38.17 trans/sec
Throughput: 3.45 MB/sec
Concurrency: 30.30
Successful transactions: 2312
Failed transactions: 0
Longest transaction: 8.86
Shortest transaction: 0.20
================================================
# Тест Siege з 100 одночасними користувачами протягом однієї хвилини.
siege -d1 -t1M -c100 nerusoft.com
root@titan-r:/etc/apache2# siege -d1 -t1M -c100 nerusoft.com
** siege 2.65b1
** Preparing 100 concurrent users for battle.
The server is now under siege...
Lifting the server siege... done.
Transactions: 2318 hits
Availability: 100.00 %
Elapsed time: 60.48 secs
Data transferred: 209.56 MB
Response time: 2.02 secs
Transaction rate: 38.33 trans/sec
Throughput: 3.46 MB/sec
Concurrency: 77.44
Successful transactions: 2318
Failed transactions: 0
Longest transaction: 23.29
Shortest transaction: 0.25
======================================================
# Тест Siege з 150 одночасними користувачами протягом однієї хвилини.
siege -d1 -t1M -c150 nerusoft.com
root@titan-r:/etc/apache2# siege -d1 -t1M -c150 nerusoft.com
** siege 2.65b1
** Preparing 150 concurrent users for battle.
The server is now under siege...
Lifting the server siege.. done.
Transactions: 2337 hits
|Availability: 100.00 %
Elapsed time: 60.47 secs
Data transferred: 211.28 MB
Response time: 3.24 secs
Transaction rate: 38.65 trans/sec
Throughput: 3.49 MB/sec
Concurrency: 125.19
Successful transactions: 2337
Failed transactions: 0
Longest transaction: 25.83
Shortest transaction: 0.26
======================================================
# Тест Siege з 200 одночасними користувачами протягом однієї хвилини.
siege -d1 -t1M -c200 nerusoft.com
root@titan-r:/etc/nginx# siege -d1 -t1M -c200 nerusoft.com
** siege 2.65b1
** Preparing 200 concurrent users for battle.
The server is now under siege...
Lifting the server siege... done.
Transactions: 2317 hits
Availability: 100.00 %
Elapsed time: 59.80 secs
Data transferred: 209.47 MB
Response time: 4.41 secs
Transaction rate: 38.75 trans/sec
Throughput: 3.50 MB/sec
Concurrency: 170.79
Successful transactions: 2317
Failed transactions: 0
Longest transaction: 25.17
Shortest transaction: 0.32Як читати ці результати
ApacheBench: швидкість і затримка
У першому ApacheBench-тесті наведено 31.37 запиту/с для 1000 запитів, у другому — 38.73 для 10 000 запитів. У серії Siege зі зростанням заданої кількості користувачів від 50 до 200 частота транзакцій залишалася близько 38/с, а час відповіді зростав. Для http_load записано команду, але результату не наведено — його не можна домислювати.
Siege: більше користувачів, довше очікування
| Віртуальні користувачі | Транзакції/с | Середній час, с | Невдалі транзакції |
|---|---|---|---|
| 50 | 38,17 | 0,79 | 0 |
| 100 | 38,33 | 2,02 | 0 |
| 150 | 38,65 | 3,24 | 0 |
| 200 | 38,75 | 4,41 | 0 |
Ця серія показує, чому одного показника «усі запити завершилися» замало. Частота транзакцій трималася майже на одному рівні, а середнє очікування росло від 0,79 до 4,41 с. Це ознака обмеження пропускної здатності саме в даному сценарії; журнал не встановлює, який ресурс був вузьким місцем.
http_load: команда без результату
За описом http_load від ACME, останній аргумент задає файл зі списком URL. Отже, nerusoft.com у наведеній команді мав би бути назвою такого файла, а не просто адресою сервера. Вміст файла й фактичний вивід тут відсутні — порівнювати його швидкість із ApacheBench чи Siege немає на чому.
Знімок тестування

Офіційна документація ApacheBench. Параметри імітації користувачів та затримок пояснює також посібник Siege. Для власного тесту погодьте ресурс, навантаження й критерії прийнятного часу відповіді; нуль невдалих транзакцій не замінює цих критеріїв.
Немає коментарів:
Дописати коментар