
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Use HTTP Stat to Analyze Website Performance
HTTP state is a Python3 script that visualizes web curl(1) statistics. This script is written in a single file without a dependency. This article explains about How to Use http stat to Find out a Website’s Performance
Installing httpstat
There are two ways to install httpstat on Ubuntu as shown below−
- Download the script directly.
- Through Python pip.
Installing from Script
To install httpstat from direct script, use the following command−
$wget https://raw.githubusercontent.com/reorx/httpstat/master/httpstat.py
The sample output should be like this −
--2016-12-19 11:27:18-- https://raw.githubusercontent.com/reorx/httpstat/master/httpstat.py Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.100.133 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.100.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 10577 (10K) [text/plain] Saving to: ‘httpstat.py’ httpstat.py 100%[===================>] 10.33K --.-KB/s in 0.02s 2016-12-19 11:27:20 (433 KB/s) - ‘httpstat.py’ saved [10577/10577]
Installing from Python pip
Before installing httpstat, It should require a python-pip package on Ubuntu. To install python-pip package, use the following command −
$sudo apt install python-pip
The sample output should be like this −
Building dependency tree Reading state information... Done The following additional packages will be installed: libexpat1-dev libpython-all-dev libpython-dev libpython2.7 libpython2.7-dev libpython2.7-minimal libpython2.7-stdlib python-all python-all-dev python-dev python-pip-whl python-pkg-resources python-setuptools python-wheel python2.7 python2.7-dev python2.7-minimal Suggested packages: python-setuptools-doc python2.7-doc binfmt-support The following NEW packages will be installed: libexpat1-dev libpython-all-dev libpython-dev libpython2.7-dev python-all python-all-dev python-dev python-pip python-pip-whl python-pkg-resources python-setuptools python-wheel python2.7-dev The following packages will be upgraded: libpython2.7 libpython2.7-minimal libpython2.7-stdlib python2.7 python2.7-minimal 5 upgraded, 13 newly installed, 0 to remove and 284 not upgraded. Need to get 29.8 MB/34.6 MB of archives. After this operation, 45.1 MB of additional disk space will be used. ......................................................................................
To install httpstat, use the following command −
$ pip install httpstat
The sample output should be like this −
Collecting httpstat Downloading httpstat-1.2.1-py2-none-any.whl Installing collected packages: httpstat Successfully installed httpstat
Usage of httpstat
If you are installed httpstat through direct script, use the following command−
$ python httpstat.py tutorialspoint.com
The sample output should be like this −
Connected to 117.18.237.191:80 from 192.168.1.182:58492 HTTP/1.1 200 OK Accept-Ranges: bytes Access-Control-Allow-Headers: X-Requested-With Access-Control-Allow-Origin: * Content-Type: text/html; charset=UTF-8 Date: Mon, 19 Dec 2016 06:09:15 GMT Last-Modified: Mon, 19 Dec 2016 05:20:54 GMT Server: ECS (pnq/AF9C) Vary: Accept-Encoding X-Cache: HIT Content-Length: 92840 Body stored in: /tmp/tmpvwKIfK DNS Lookup TCP Connection Server Processing Content Transfer [ 253ms | 16ms | 15ms | 32ms ] | | | | namelookup:253ms | | | connect:269ms | | starttransfer:284ms | total:316ms
Usage of httpstat through Python Pip
If you have installed httpstat through python pip, use the following command−
$ httpstat sendfiles.net
The sample output should be like this −
Connected to 115.112.255.70:80 from 192.168.1.182:46878 HTTP/1.1 200 OK Date: Mon, 19 Dec 2016 06:11:59 GMT Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips PHP/5.4.16 X-Powered-By: PHP/5.4.16 Set-Cookie: PHPSESSID=ftvfqeu3gnr05a95hc2donbv16; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Vary: User-Agent Access-Control-Allow-Origin: * Access-Control-Allow-Headers: X-Requested-With Transfer-Encoding: chunked Content-Type: text/html; charset=UTF-8 Body stored in: /tmp/tmpq7FNyi DNS Lookup TCP Connection Server Processing Content Transfer [ 254ms | 1ms | 6ms | 2ms ] | | | | namelookup:254ms | | | connect:255ms | | starttransfer:261ms | total:263ms
Output Explanation
The above example gives the output of tutorialspoint.com and sendfiles.net. It involves the information about Date,Server, X-Powered-by way of, Set-Cookie,vary, content material-kind, and many such valuable information to search out the stats of web pages.
There are so many bunch of options are on hand in httpstat, To get the more understanding about httpstat, use the following command-
$ httpstat --help
The sample output should be like this −
Usage: httpstat URL [CURL_OPTIONS] httpstat -h | --help httpstat --version Arguments: URL url to request, could be with or without `http(s)://` prefix Options: CURL_OPTIONS any curl supported options, except for -w -D -o -S -s, which are already used internally. -h --help show this screen. --version show version. Environments: HTTPSTAT_SHOW_BODY Set to `true` to show resposne body in the output, note that body length is limited to 1023 bytes, will be truncated if exceeds. Default is `false`. HTTPSTAT_SHOW_IP By default httpstat shows remote and local IP/port address. Set to `false` to disable this feature. Default is `true`. HTTPSTAT_SHOW_SPEED Set to `true` to show download and upload speed. Default is `false`. HTTPSTAT_SAVE_BODY By default httpstat stores body in a tmp file, set to `false` to disable this feature. Default is `true` HTTPSTAT_CURL_BIN Indicate the curl bin path to use. Default is `curl` from current shell $PATH. HTTPSTAT_DEBUG Set to `true` to see debugging logs. Default is `false`
The above command gives the clear information about httpstat and options for usage.After this article, you will be able to understand How to Install httpstat to find out a website Performance Statistics on Ubuntu. In our next articles, we will come up with more Linux based tricks and tips. Keep reading!