लिनक्स टर्मिनल में वेबसाइट लोड करने की गति का परीक्षण कैसे करें


एक वेबसाइट प्रतिक्रिया समय उपयोगकर्ता के अनुभव पर बहुत प्रभाव डाल सकता है, और यदि आप एक वेब डेवलपर हैं, या बस एक सर्वर व्यवस्थापक हैं जो टुकड़ों को एक साथ व्यवस्थित करने के लिए विशेष रूप से जिम्मेदार हैं, तो आपको इसे एक ऐसा बिंदु बनाना होगा जो उपयोगकर्ताओं को महसूस न हो अपनी साइट तक पहुँचने के दौरान निराश - तो वास्तव में " गति की आवश्यकता है "।

यह गाइड आपको दिखाएगा कि लिनक्स कमांड लाइन से वेबसाइट रिस्पांस टाइम का परीक्षण कैसे करें। यहां, हम सेकंड में समय की जांच करने का तरीका बताएंगे, इसमें समय लगता है:

  • to perform name resolution.
  • for TCP connection to the server.
  • for the file transfer to begin.
  • for the first byte to be transferred.
  • for the complete operation.

इसके अतिरिक्त, HTTPS- सक्षम साइटों के लिए, हम यह भी देखेंगे कि कैसे समय का परीक्षण करना है, सेकंड में, यह लेता है: एक रीडायरेक्ट और सर्वर से पूरा करने के लिए SSL कनेक्शन/हैंडशेक के लिए। यह अच्छा लगता है, ठीक है, चलो शुरू हो जाओ।

cURL एक शक्तिशाली कमांड लाइन उपकरण है जो FILE, FTP, FTPS, HTTP, HTTPS और कई अन्य जैसे प्रोटोकॉल का उपयोग करके या सर्वर से डेटा स्थानांतरित करने के लिए है। ज्यादातर मामलों में, यह कमांड लाइन डाउनलोडर के रूप में, या HTTP हेडर की जाँच के लिए उपयोग किया जाता है। हालांकि, यहां, हम इसकी कम-ज्ञात कार्यात्मकताओं में से एक का वर्णन करेंगे।

cURL के पास एक उपयोगी विकल्प है: -w एक पूर्ण ऑपरेशन के बाद stdout पर जानकारी प्रिंट करने के लिए। इसके कुछ चर हैं जिनका उपयोग हम वेबसाइट पर, ऊपर सूचीबद्ध विभिन्न प्रतिक्रिया समय का परीक्षण करने के लिए कर सकते हैं।

हम समय-संबंधी कुछ चर का उपयोग करेंगे, जिन्हें किसी दिए गए प्रारूप में शाब्दिक स्ट्रिंग के रूप में या किसी फ़ाइल के अंदर पारित किया जा सकता है।

इसलिए अपना टर्मिनल खोलें और नीचे कमांड चलाएँ:

$ 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

उपरोक्त प्रारूप में चर हैं:

  • 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).

यदि प्रारूप बहुत लंबा है, तो आप इसे एक फ़ाइल में लिख सकते हैं और इसे पढ़ने के लिए नीचे दिए गए सिंटैक्स का उपयोग कर सकते हैं:

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

उपरोक्त आदेश में, ध्वज:

  • -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).

HTTPS साइटों के लिए, आप नीचे कमांड चला सकते हैं:

$ 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

उपरोक्त प्रारूप में, नया समय चर हैं:

  • 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.

महत्वपूर्ण बिंदुओं पर ध्यान दिया जाना चाहिए।

  • You will notice that the response time values keep on changing (due to several factors) as you run different tests, therefore it is advisable to collect several values and get an average speed.
  • Secondly, from the results of the commands above, you can see that accessing a website over HTTP is much faster than over HTTPS.

अधिक जानकारी के लिए, CURL मैन पेज देखें:

$ man curl

अंतिम लेकिन कम से कम, यदि आपके परिणाम प्रसन्न नहीं होते हैं, तो आपके पास अपने सर्वर पर या कोड के भीतर करने के लिए कुछ समायोजन हैं। आप निम्नलिखित ट्यूटोरियल का उपयोग करने पर विचार कर सकते हैं जो लिनक्स में वेबसाइट (एस) को तेजी से लोड करने के लिए प्रोग्राम और टिप्स बताते हैं:

  1. Install Nginx with Ngx_Pagespeed (Speed Optimization) on Debian and Ubuntu
  2. Speed Up Nginx Performance with Ngx_Pagespeed on CentOS 7
  3. Learn How to Speed Up Websites Using Nginx and Gzip Module
  4. How to Boost Linux Server Internet Speed with TCP BBR

बस इतना ही! अब आप जानते हैं कि कमांड लाइन से वेबसाइट रिस्पांस टाइम का परीक्षण कैसे किया जाता है। आप नीचे दिए गए फीडबैक फॉर्म के माध्यम से प्रश्न पूछ सकते हैं।