Back to index

Test TTFB response times with siege

Published

As I’ve recently changed some of my personal server’s infrastructure I wanted to test the response time of it. One tool that I’ve found useful for that is siege.

Why do I write this post and not a post about what happens after the first server response have been downloaded and parsed by the browser? E.g., something about images, css or javascript. Because often you have much more lower hanging fruit to pick there. But now I wanted to test my new puma setup, right 😏.

Next learning is that I should focus on “frontend” performance, if that’s an expression. Meanwhile I’ll link a resource about performance from a user’s perspective to compensate.

If not changed in the settings, siege will parse the html and pull down all the images, css and other external content that is referenced. I don’t know exactly where they draw the line. And to change this, you need to edit the config file (please introduce a options argument). Check where that is located by running:

siege --config

Somewhere down there there’s a line saying:

resource file: /Users/joel/.siege/siege.conf

Go into that file and change the parser into false like this:

parser = false

And then you can only focus on the server’s response time (TTFB), all the other stuff I think there’s better tools for the job. Your browser’s developer tools for starters.

This will try to run 5 concurrent clients with 5 hits each:

siege https://bolmaster2.com -c 5 -r 5

It will show you the current requests being done and then show you a summary like this:

Transactions:		          25 hits
Availability:		      100.00 %
Elapsed time:		        3.11 secs
Data transferred:	        0.04 MB
Response time:		        0.30 secs
Transaction rate:	        8.04 trans/sec
Throughput:		        0.01 MB/sec
Concurrency:		        2.38
Successful transactions:          25
Failed transactions:	           0
Longest transaction:	        0.48
Shortest transaction:	        0.16