Categories
Cloud NiHao Cloud Documentation Products Sotfware & DevOps Tools & HowTo

Performance Test of NiHao Cloud with curl

Performance Test of NiHao Cloud using curl

In today’s dynamic world, time is the most critical aspect for any business person. Whether it’s deciding to trade off or launching a new product, reaching the customers within the least possible time filter you from the majority crowd.

Updated on: June 22, 2021

How much your customers wait for your website to load? 5 -seconds? 10 seconds? Probably not more than that! And in the end, the client leaves the website heavy-heartedly and downvotes the user experience. So, good to be on the safer side and check the latency tests beforehand.  In this article will talk about curl and how to use it for performance testing. This is a very popular open-source tool with it’s first release about about 23 years ago. First we will start by introducing some of the flag features of the tool. By the way these features are used that are used for many purposes like testing, troubleshooting, and much more. Finally In this article we will show you how to use if for a Performance Test of NiHao Cloud.

We’ve taken curl (a powerful command-line tool to transfers data from or to a server) and using Linux based operating system. Curl is a command-line utility for transferring data from or to a server designed to work without user interactions. Curl supports various options allowing the user to resume the transfer, measure and limit the bandwidth, proxy support, user authentication, and much more. It is simple, scriptable, scalable, flexible yet powerful. Curl is generally pre-installed in Linux-based systems.

site performance testing cover image
site performance test
Let’s discuss some of the popular options from curl:

-I (–head) — This option fetches the header only. For HTTP-based servers, fetches the header of the document and for file, it displays the file size and last modification time.

-X (–request) — With this option, one can explicitly specify the request method when communicating with HTTP-based servers. The specified method will be applied instead of the default one.

-v (–verbose) — It makes curl verbose during the operation. Very useful in troubleshooting and observing the “behind the scene” process. Further in the command line, output starting with “>” menas header data sent by curl, and “<” means header data received by curl.

-H (–header) — User can include extra header content in the request to the HTTP server. In addition, we may specify any number of customized headers and it will make sure that each added header will be sent with proper markup.

-L (–location) — If the server comes to know that the requested page has been moved to another location, then this option will redo the curl operation with an alternative location. This method won’t intercept the user credentials for authentication to an alternative location if the initial location is not present.

-K (–config) — Use this to specify a file to read arguments and use as input for curl command. It will create an illusion as if the arguments are passed via the command line itself.

-u (–user) — We can pass username and password to use for server authentication. If the username is passed, curl will prompt for the password. One should not pass sensitive information in plain text Pass it via file or follow some security practices.

  The steps would be nearly the same with another os as well. In the demonstration part, we will use time-related variables and test the same with 2 different networks in 2 different region(i.e: India and USA).

Demonstration:

Now, here is where we show you how to use curl for the purpose of a Performance Test of NiHao Cloud. Let’s get to it!

  • Create a file which has arguments that curl command takes:
time_namelookup: %{time_namelookup}
time_connect: %{time_connect}
time_pretransfer: %{time_pretransfer}
time_starttransfer: %{time_starttransfer}
———
time_total: %{time_total}
  • Here, 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.
  • Now use this file and make curl request to the target website:
   Command: curl -w "@curl-format.txt" -o /dev/null -s http://app.nihaocloud.com/org/register/ 

Here, -w @”curl.txt” tells to use the mentioned file. –O option redirects the output to /dev/null and –s suppresses the progress bar. The target website is our Cloud Storage https://app.nihaocloud.com

Result 1: Using the wifi connection:

The results of the performance test below are in the Seconds unit. We measured the results from the Indian region and connected them to the servers in Korea.

Console curl register
Result1: through wifi network
Result 2: Using the Mobile Network
Console register curl output
Result2: through mobile network

Besides, let’s perform the same operation with different geolocation to ensure availability at other dimensions as well. In the example, we’ve taken North Virginia(USA) region. The results are identically the same as with the Indian region.

Result 1: Using the wifi connection:

Through wifi network
Result1: Through WiFi network

Result 2: Using the wifi connection:

Through mobile network
Through mobile network

We tried to show a small demonstration of site latency/speed testing. We at NiHao cloud always try to give the best services to our clients across the globe and results are mirrored above. Stay tuned for such interesting articles and the best services.

By Poojan Mehta

Poojan Mehta lives in Gujrat, India, and pursuing a bachelor's degree in computer science. He has extensive experience in the software industry. As a technical enthusiast, he has been involved in various roles that include public cloud administration, database administration with SQL Server, web and mobile app development, DevOps work, technical writing, and mentoring. He is proficient in various operating systems, including Red Hat Linux and Windows. He is especially keen on developing new systems with emerging technologies.

One reply on “Performance Test of NiHao Cloud with curl”

Start Sharing and Storing Files for Free

You can also get your own Unlimited Cloud Storage on our pay as you go product.
Other cool features include: up to 100GB size for each file.
Speed all over the world. Reliability with 3 copies of every file you upload. Snapshot for point in time recovery.
Collaborate with web office and send files to colleagues everywhere; in China & APAC, USA, Europe...
Tear prices for costs saving and more much more...
Create a Free Account Products Pricing Page