brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ab -n -c gives a quick load test of a web page

Web-Development
~/tips/tip-ab-apache-bench-quick-load-test

ab -n 200 -c 10 https://example.com/

Send many concurrent requests to a URL to see how the server copes

Before you tune a web server it helps to have a number. ApacheBench gives one in seconds.

Send 200 requests, 10 at a time:

ab -n 200 -c 10 https://example.com/

-n is the total number of requests and -c how many run concurrently. The report shows requests per second, the time per request, the spread of response times and how many requests failed. Rerun it after a change and compare the numbers.

The tool comes with the Apache utilities, for example the apache2-utils package on Debian and Ubuntu. Add a trailing slash to the URL, as ab needs a path.

A caveat: it is a crude tool. It speaks only HTTP/1.0 style requests by default, hits one URL and uses no real browser behaviour, so treat results as a rough comparison. Only test servers you own, because a big run looks like an attack to anyone else.

Further reading: ApacheBench documentation

More Web-Development tips console.assert(items.length > 0, 'cart is empty', items) document.designMode = "on" function save(item) { Save draft spellcheck="false" All Web-Development tips (67) All topics

Link