Benchmarking a webpage response time (for web developers)

It is good practice to benchmark your webpages and API endpoints before pushing them live to production. This can help identify areas of improvement which can be used to inform decisions on caching techniques (e.g. utilise Redis or Memcached), database query optimsations (take queries out of loops) and pagination (implement pagination or decrease page size if requests are taking too long).

Last week, I was searching for a tool to benchmark load times which I coincidentally stumbled upon today. This tool is called ab (ApacheBenchmark).

Here is the syntax I used…

ab -c 100 -n 100 -C "jwt=<jwt cookie goes here>" "https://tennant.io/test/"

-c: set the number of concurrent requests (at one time).
-n: set the number of total requests to perform
-C: set the cookie for the requests

Replace my values with your own.

The result of this command contains userful information such as Time per request (mean) and Time per request (mean, across all concurrent requests). See this link to learn the difference.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *