How to troubleshoot HTTP request performance with curl statistics
Article Number: 000020164
Situation
Task
When troubleshooting a performance issue with a web-based endpoint, it's important to have metrics that assist in understanding what areas are related.
This is where using a lightweight tool like curl, and it's ability to write out the statistics of a request can be very useful.
Pre-requisites
You will just need curl installed and available from the location performing the test.
Steps
Download the format file to use with curl:
curl -OLs https://raw.githubusercontent.com/rancherlabs/support-tools/master/files/curl-format.txt
You should now have a curl-format.txt
file locally in the current directory.
Using the file and the -w
flag, perform the desired request to the service, the example below displays the headers and statistics.
curl -I -w "@curl-format.txt" https://rancher.com
Timing statistics will be output with each run of the command, measurements are recorded in seconds.
Note: run the command from a location that provides an accurate reproduction of the issue, to simulate the issue as closely as possible. Using the same request parameters are important - like the path and headers that might be used by client applications.