Test Kecepatan Loading Website dengan Terminal Linux

Tuesday, August 7, 2018

Test Kecepatan Loading Website dengan Terminal Linux - Mungkin kalian pernah melakukan test berapa kecepatan loading di blog kalian. Hal itu tentunya memiliki alasan misalnya saat melakukan optimasi theme maupun optimasi server. Nah, dengan terminal, kita juga bisa melakukan testing kecepatan website memanfaatkan fitur curl.



berikut perintah beserta penjelasannya:
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 https://blog.linuxsec.org
Keterangan variabel diatas:
  • 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 connect 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).


Dan beberapa parameter curl yang digunakan dalam perintah diatas :
  • -s – tells curl to work silently.
  • -w – print the information on stdout.
  • -o – used to redirect output (here we discard the output by redirecting it to /dev/null).

Jika perintah diatas terlalu panjang, kakian bisa membuatnya menjadi bash file yang nantinya bisa digunakan dengan memanggil nama file bash nya seperti screenshot yang saya lampirkan diatas.

nano test.sh

lalu isinya:
#!/bin/bash
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 $1

Cara menggunakannya:
bash test.sh blog.linuxsec.org

Oke sekian tutorial singkat kali ini dan semoga bermanfaat.

Referensi:
  • https://www.tecmint.com/test-website-loading-speed-in-linux-terminal/

Artikel Terkait Terminal ,Utilities

No comments:

Post a Comment