هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
ماذا يفعل
ab comes with Apache httpd tools and is on almost every server. It sends one URL again and again and prints a summary: requests per second, time per request, failed requests and the latency percentiles. It is simple: one URL, no scripts. For real scenarios use k6.
Good for: a quick before/after check of an nginx change, a cache, or a new server size.
طريقة الكتابة
ab [OPTIONS] URLالخيارات 14
الأكثر استخدامًا
Options
لا يوجد شيء يطابق هذا الفلتر.
أمثلة 10
$ مستخدم عادي# بصلاحية root (أو مع sudo)
11000 requests, 50 at a time
ab -n 1000 -c 50 https://staging.example.com/ Requests per second: 812.40 [#/sec] (mean) Time per request: 61.546 [ms] (mean) Failed requests: 02With keep-alive (like real browsers)
ab -k -n 5000 -c 100 https://staging.example.com/3Test an API with a token
ab -n 500 -c 20 -H "Authorization: Bearer $TOKEN" https://staging.example.com/api/products4POST JSON
echo '{"sku":"BA-101"}' > body.json ab -n 200 -c 10 -p body.json -T application/json https://staging.example.com/api/cart5Run for 30 seconds
ab -t 30 -c 50 https://staging.example.com/6Dynamic pages have different lengths: do not count them as failed
ab -l -n 1000 -c 50 https://staging.example.com/search?q=racket7Compare before and after a change
ab -k -n 2000 -c 50 https://staging.example.com/ | grep -E 'Requests per second|95%'8Save the percentiles for a report
ab -n 1000 -c 50 -e result.csv https://staging.example.com/9Install on RHEL / Ubuntu
dnf install httpd-tools apt install apache2-utils10Debug the headers of one request
ab -n 1 -v 2 https://staging.example.com/
لا يوجد شيء يطابق هذا الفلتر.
انتبه
- The URL needs a path:
https://host/(with the last slash), nothttps://host. - ab uses HTTP/1.0 and one URL; results look better than real traffic.
- Do not benchmark production or other people's servers without permission.
رموز الخروج
0 | The test ran. |
1 | Error (bad URL, cannot connect). |