Advance

The Ultimate Guide to Testing Website Loading Speed in Linux

How to test website loading speed in Linux
1
(1)

In this fast-paced world of technology, it is quite evident that a slow loading website is not ideal for luring any potential visitors or keeping those that have already accessed the site. If you happen to be a Linux user and want to speed up your website to its optimum, then you’ve got the destination right. In this guide, we will explain various ways and tools which may help you testing website loading speed in Linux.

How to test website loading speed in Linux

In the following, we will show you how to how to test a website response time from the Linux command line. you will see how to check the time in seconds, it takes:

1- To perform name resolution.

2- For TCP connection to the server.

3- For the file transfer to begin.

4- For the first byte to be transferred.

5- For the complete operation.

Also, for HTTPS-enabled sites, you would verify how to test the time, in seconds, it takes:

  • for a redirect
  • SSL connection/handshake to the server (to be completed)
Recommended Article: How to install Nextcloud in Ubuntu

Buy Linux Virtual Private Server

 

Of course, you know about the cURL, yes, the powerful command-line tool to transfer data from or to a server that uses the FILE, FTP, FTPS, HTTP, HTTPS, and many other protocols. But we will learn you one of the lesser-known functionalities.

After a completed operation, you can use the useful option of cURL, -w, to print information on stdout.  It means that you may use some of its time-related variables to test the different response times listed above, of a website. 

$ curl -s -w 'Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null http://www.google.com

You may see the variables, that we review their formats:

time_namelookup – time, in seconds, it took from the start until the name resolving was completed.

time_connect – time, in seconds, it took from the start until the TCP connection to the remote host (or proxy) was completed.

time_pretransfer – time, in seconds, it took from the start until the file transfer was just about to begin.

time_starttransfer – time, in seconds, it took from the start until the first byte was just about to be transferred.

time_total – total time, in seconds, that the full operation lasted (millisecond resolution).

Also, you can use use the syntax below, if the format was too long.

$ curl -s -w "@format.txt" -o /dev/null https://www.google.com

And in the above command, the flag:

  • -s – tells curl to work silently.
  • -w – print the information on stdout.
  • -o – used to redirect the output (here we discard the output by redirecting it to /dev/null).

Run the following command for HTTPS sites.

$ curl -s -w 'Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nAppCon Time:\t\t%{time_appconnect}\nRedirect Time:\t\t%{time_redirect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null https://www.google.com

And again, in the above  format, the new time variables are:

time_appconnect – time, in seconds, it took from the start until the SSL connect/handshake to the remote host was completed.

time_redirect – time, in seconds, it took for all redirection steps including name lookup, connect, pretransfer, and transfer before the final transaction was started; it computes the full execution time for multiple redirections.

Note:

1- As the response time values would always change, try to collect several values and get average speed, because you run different tests.

2- Due to the results of the commands above, you can see that accessing a website over HTTP is much faster than over HTTPS.

You are recommended to visit the cURL man page to get more information.

man curl

Conclusion

Verifying the speed at which your website loads in the Linux OS is the best way to guarantee that you provide your users with a completely modern and fast-operating resource. By adhering to the instructions given in this particular guide and using the tools and the methods at your disposal, it is possible to recognize those parts of the website which can be improved further and implement changes which might speed up its load time. Continuous improvement and provision of enhanced browsing capabilities will help you to keep outsmarting your competitors in this very busy field of competition.

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

View More Posts
Tom Veitch
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day