Sunday, May 28, 2017

Load Testing the FTP Site with Open Source Apache Jmeter

Sometimes we might have to load test your website/ ftp site for reliability or to measure performance. The top listed open-sourced tools are:
  • The Grinder
  • Gatling
  • Tsung
  • JMeter
(item list from bazemeter.com)
Out of the top 4, I'll use Apache JMeter which has a good reputation and is available for windows platform. A lot of options are available for beginner to advanced testers. Java will be needed prior to Jmeter installation. Test if you machine already has java installed in the command prompt by typing:
java -version
If not installed, download java from here.
Download Jmeter for windows from sourceforge.

Test Scenario
  • We will load test the windows ftp site which has user isolation for each directory. (if you don't know how to create ftp with user isolation, check my post FTP with Local User Isolation & FTP with Domain User Isolation). But you can test the Normal FTP site as well.
  • 200 users will access and upload the procexp.exe file from his computer to his ftp directory at the same time.
  • Each user has a different username and password.
 If you use only 1 user account for this load-test, you don't need a csv file, instead you can use the username,password directly.

Step-1: Prepare the csv file and put the file to be uploaded into the Jmeter directory
Prepare the csv file with usernames and password. Then, put the file (the file you want to upload) into the Jmeter's installation directory (this is needed to avoid the file path complication issue). For me, I want to stimulate uploading the "procexp.exe" into each users' directory on ftp site. So, I need to put the file into "C:\Program Files\JMeter\bin". You can get the installation directory by checking the Start in property of the Jmeter's shortcut on desktop. See Fig-1 for all details.



 Fig-1: Preparing csv file and place the procexp.exe file into the Jmeter's install directory
 
Step-2: Add Thread Group & Stimulation Parameters
Open the Jmeter. There will be 2 nodes: Test Plan and Workbench. Both can do for the same purpose. (The only difference is saving the "Test Plan" in File menu doesn't save the Workbench.)
First of all, you need to add the Thread Group which defines how many users/how long your load test your target. See Fig-2.
**Do not use too high threshold for production servers.**
 Fig-2: Adding Threads

We will change the "Thread Group" name to "FTP Load Test". Change the number of users to 200 to access the ftp site. Change the Ramp-up period to 1 so that all 200 users' request will hit the server immediately once we start the test.


The ramp-up period tells JMeter how long to take to "ramp-up" to the full number of threads chosen. If 10 threads are used, and the ramp-up period is 100 seconds, then JMeter will take 100 seconds to get all 10 threads up and running. Each thread will start 10 (100/10) seconds after the previous thread was begun. If there are 30 threads and a ramp-up period of 120 seconds, then each successive thread will be delayed by 4 seconds.(source from apache site)


And set the loop count to 1 and scheduler duration to 120 seconds. See Fig-3.
Fig-3: Adding Stimulation Metric
Step-3: Type of Test (Sampling) & Testing Parameters
You have to choose types to request to perform. Choose "FTP Request" from Sampling option. See Fig-4.
Fig-4: Choosing types of sampling
Then, fill up the below parameters for the FTP requests as shown in Fig-5.
  • Name: Name of the test type. You can leave it as default as FTP Request.
  • Server Name or IP: The hostname or iP address of FTP server.
  • Remote File: The remote directory which you will get/put files on FTP server. The default home directory is defined as "\".
  • Local File: The local file directory of your client machine which you will upload/download files. The default directory is where Jmeter's installation files resides (usually C:\Program Files\JMeter\bin). So, if you use the filename only, you'll have to put the file into that installation directory as I copied my procexp.exe file into the bin directory earlier in this post.
  • Username: The username to log into the ftp site. If you use the csv file with usernames & passwords. You have to use the ${username} , which is the variable that represents each user name in csv file. username in the bracket is the header name of user name column in csv file.
  • Password: The password to log into the ftp site. If you use the csv file with usernames & passwords. You have to use the ${password} , which is the variable that represents each password in csv file. password in the bracket is the header name of password column in csv file.
Since I choose to upload the file into each user's directory, select the put(STOR) option. See the Fig-5 for the above explanation.
Note: If you use only 1 user account to load-test the ftp site, you will need to fill up the actual name & password in the above fields. Also, skip step-5 and continue with step-6.

Fig-5: Putting up necessary parameters for FTP request
Step-4: Add CSV file
First, you have choose to use csv file in your configuration element. Select your test plan and add Config Element >> CSV Data Set Config. See Fig-6.
Fig-6: Adding CSV Data Set Config
Then, fill up the necessary parameters for this CSV Data option.
  • Filename: The full file path where csv file is located.
  • File encoding: The file encoding to use. Leave it default if you use ASCII only.
  • Variable Names: The header names of each column, separated by commas. For me, I put username,password.
  • Delimiter: The delimiter to read the file. Since, we use csv, put (,) in the field.
Leave the others settings as default. See Fig-7. 





Fig-7: CSV File settings
Step-5: Add Listeners to for the different result views
Now, we can see our results by adding the listeners. Each listener has different result view & performance metric. We will add 3 listeners for our test:
  • View Results in Table: All results with timestamps, status, bytes, Latency in table.
  • View Results Tree: The result in tree view. More details with log on the right-hand side.
  • Response Latencies Over Time: The reponse lantancy from ftp server in milliseconds in Graph view.

You can add these listeners by the following path.
Test Plan >> Add >> Listener >> View Results in Table
Test Plan >> Add >> Listener >> View Results in Tree
Test Plan >> Add >> Listener >> Response Latencies Over Time
Fig-8 shows how to add View Results in Table. The other two are the same.

 Fig-8: Adding Listener to view the result in table format

Step-6: Run the test & See the results
Now you can run the test by clicking the Start button. See Fig-9.


Fig-9: Start the performance test
The results will be displayed as Table, as Tree & as a Response Time Graph. See Fig-10 & Fig-11.
Fig-11: The Tree View with connection logs for each user
Fig-12: The response latencies over time

3 comments:


  1. Nice Blog Techsaga, as Software development company experts, deliver inspiring, eye-catching designs and measurable campaigns that connect with target audiences, boost online marketing and encourage business growth. We can help you meet your needs across a range of full service online marketing services. Are you looking for help with great content, SEO, PPC campaigns, a full digital marketing strategy, campaign, or something else? No matter what you need, our experts can help you.

    ReplyDelete
  2. Nice Blog, Best best microsoft office deals for Mac Home and Business edition is a powerful suite which fulfils the productivity applications, written for Mac OS X.

    ReplyDelete
  3. Great Content. Thanks for sharing this valuable information. It will be useful for knowledge seekers.
    JMeter Training in Chennai
    JMeter Certification

    ReplyDelete

Note: Only a member of this blog may post a comment.