The sys admin's daily grind – httpstat
My Point of View
Httpstat is a special stopwatch you can use to discover how long web servers take to serve up a static or dynamic HTML page. Visible performance lags indicate optimization potential for the server.
Httpstat is a Python script that wraps itself around cURL. Apart from Python 2 or 3 and cURL, it has no other dependencies. You can retrieve it from the GitHub repository and call it using:
wget https://raw.githubusercontent.com/reorx/httpstat/master/httpstat.py python httpstat.py <URL>
If the Python installer pip
is present on your system, you also can pick up the script and call it with:
pip install httpstat httpstat <URL>
Although you can leave an http://
out of the URL, you cannot omit https://
for web pages secured with TLS.
Figure 1 shows httpstat measuring an unencrypted call. Four milliseconds for a DNS reply is a really good value, but I cheated: The name of the site is cached on my local Dnsmasq. As soon as my computer has to turn to my provider's DNS, the value rises to 80-200ms. The TCP handshake is 22ms, which is about par for the course.
The time the server needs to create the page (Server Processing) shows whether the web server has some tuning potential that I have not tapped. My example is not representative, because instead of HTML, the server simply outputs 301 Moved Permanently, which means I should have called the page using HTTPS. A browser would do that independently, but not cURL.
Figure 2 requests the same page using HTTPS. The lookup and TCP values remain the same, but the TLS Handshake takes forever for this static page. The value can go up to several seconds for a big site with a large volume of dynamic content and advertising banners.
Httpstat is not controllable using command-line parameters because they would be fielded by cURL; however, you can influence the tool with environment variables. The line
export HTTPSTAT_SHOW_SPEED=true
tells httpstat to show how quickly the web page is delivered (e.g., speed_download: 219.6 KiB/s, speed_upload: 0.0 KiB/s). The httpstat website [1] explains all of the variables and has links to the httpstat implementation in Go, Bash, and PHP.
Infos
- httpstat: https://github.com/reorx/httpstat
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.
-
The Gnome Foundation Struggling to Stay Afloat
The foundation behind the Gnome desktop environment is having to go through some serious belt-tightening due to continued financial problems.
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.