How to use the command httping (with examples)
Description: The httping
command is used to measure the latency and throughput of a web server. It helps in testing the response time and checking the performance of a server.
Use case 1: Ping the specified URL
Code:
httping -g url
Motivation: This use case is helpful when you want to measure the response time of a specific URL. It allows you to check the latency and throughput of a web server by sending HTTP requests to a particular URL.
Explanation:
-g
flag: Specifies that the command will follow the GET method to send HTTP requests.url
: The URL that needs to be pinged. Replaceurl
with the desired URL.
Example Output:
PING url:80 (http://url):
connected to url:80 (http://url), seq=0 time=23.09ms
connected to url:80 (http://url), seq=1 time=20.92ms
connected to url:80 (http://url), seq=2 time=19.96ms
connected to url:80 (http://url), seq=3 time=23.17ms
connected to url:80 (http://url), seq=4 time=20.87ms
--- http://url ping statistics ---
5 connects, 5 ok, 0.00% failed
round-trip min/avg/max = 19.96/21.60/23.17 ms
Use case 2: Ping the web server on host
and port
Code:
httping -h host -p port
Motivation: This use case is useful when you want to measure the latency and throughput of a specific web server on a particular host and port. It helps in checking the response time of the server on a specific network configuration.
Explanation:
-h
flag: Specifies the host where the web server is running. Replacehost
with the desired host.-p
flag: Specifies the port of the web server. Replaceport
with the desired port number.
Example Output:
PING host:port (http://host:port):
connected to host:port (http://host:port), seq=0 time=13.59ms
connected to host:port (http://host:port), seq=1 time=14.86ms
connected to host:port (http://host:port), seq=2 time=13.00ms
connected to host:port (http://host:port), seq=3 time=13.08ms
connected to host:port (http://host:port), seq=4 time=13.30ms
--- http://host:port ping statistics ---
5 connects, 5 ok, 0.00% failed
round-trip min/avg/max = 13.00/13.56/14.86 ms
Use case 3: Ping the web server on host
using a TLS connection
Code:
httping -l -g https://host
Motivation: This use case is beneficial when you want to measure the latency and throughput of a web server that uses a TLS (Transport Layer Security) connection. TLS ensures secure communication between the client and the server.
Explanation:
-l
flag: Specifies that the command will use a TLS connection.-g
flag: Specifies that the command will follow the GET method to send HTTP requests.https://host
: The URL of the web server with a TLS connection. Replacehost
with the desired host.
Example Output:
PING host:443 (https://host):
connected to host:443 (https://host), seq=0 time=57.82ms
connected to host:443 (https://host), seq=1 time=61.80ms
connected to host:443 (https://host), seq=2 time=63.29ms
connected to host:443 (https://host), seq=3 time=58.74ms
connected to host:443 (https://host), seq=4 time=58.28ms
--- https://host ping statistics ---
5 connects, 5 ok, 0.00% failed
round-trip min/avg/max = 57.82/59.58/63.29 ms
Use case 4: Ping the web server on host
using HTTP basic authentication
Code:
httping -g http://host -U username -P password
Motivation: This use case is handy when you want to measure the latency and throughput of a web server that requires HTTP basic authentication. It helps in testing the response time of a server that has username and password-based authentication.
Explanation:
-g
flag: Specifies that the command will follow the GET method to send HTTP requests.http://host
: The URL of the web server. Replacehost
with the desired host.-U
flag: Specifies the username for authentication.username
: Replaceusername
with the desired username.-P
flag: Specifies the password for authentication.password
: Replacepassword
with the desired password.
Example Output:
PING host:80 (http://host):
connected to host:80 (http://host), seq=0 time=27.76ms
connected to host:80 (http://host), seq=1 time=27.24ms
connected to host:80 (http://host), seq=2 time=26.70ms
connected to host:80 (http://host), seq=3 time=29.71ms
connected to host:80 (http://host), seq=4 time=26.95ms
--- http://host ping statistics ---
5 connects, 5 ok, 0.00% failed
round-trip min/avg/max = 26.70/27.27/29.71 ms
Conclusion:
The httping
command is a valuable tool for measuring the latency and throughput of web servers. With its various options and flags, it provides flexibility in testing different scenarios such as pinging specific URLs, measuring server response on different host and port combinations, testing TLS connections, and checking server performance with authentication. It helps in identifying any potential performance issues and ensuring the optimal functioning of web servers.