Load Testing an SMTP application using JMeter & Postal
In this blog, we will see how to perform load testing of an SMTP application exhaustively. We will be doing that using two tools, namely :
1) Postal
2) JMeter
Postal is a program which tests the performance of SMTP email servers by sending random messages to the specified server. We can test the performance and throughput of an SMTP mail server by configuring different values for options available.
In ubuntu, we can install Postal by running the following command in the terminal.
[shell]sudo apt-get install postal[/shell]
In the following example, we configure it to have 10 separate connections capable of sending maximum of 100 messages per connection of maximum size of 3 Kilobytes each. We’ll be setting it up to send a maximum of 1000 messages per minute.
There are some options that we need to specify while running the Postal command.
Options | Description |
-m<3> | Specifies maximum message body size in Kilobytes (random size selected for each message from 0-specified value). |
-t<10> | Specifies the number of threads that should be created for separate connection attempts (defaults to 1) |
-c<100> | Specifies number of messages per SMTP connection (random number of messages selected between 1-value specified). Defaults to 1, i.e. infinite number of messages. |
-r<100> | Specifies maximum number of messages per minute, defaults to 24000. Used to limit the throughput of the system. |
-f <sender> | Specifies a file containing the envelope sender of the message & a list of users that will be in the ‘From:’ field. |
[localhost]<25000> | Specifies the IP address/name of the mail server to send the mail to (localhost – for connecting to the same machine). ‘[ ]’ can be omitted if using default port – 25. 25000 specifies the port number. |
receivers | Specifies a file containing a list of user’s email addresses that can be just user-names or fully qualified email addresses (i.e. user@domain) |
You can see a list of all the available options here
Running the above command spits out logs which among other things indicate the messages sent, errors encountered per minute the tool was active and so on.
JMeter is a tool which is designed for load testing and measuring performance. It can be used to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types.
Download the zip file and extract it. To run JMeter, execute the script file located in the bin folder.
[bash]
sudo bin/.jmeter
[/bash]
This will open the JMeter window as shown below.
Here we see two tabs, namely :
1. Test Plan,
2. WorkBench
Building a Test Plan
A Test Plan describes a series of steps JMeter will execute when run. To build a test plan, we need to add following elements to it :
1) Thread Group : Any test plan begins with a Thread group element, and all controllers and samplers must be added under a thread group. We can add a Thread Group to test plan as shown below.
Configure values for the thread properties in the thread group as shown below.
2) SMTP sampler : After thread group is added, we need to add a sampler to the thread group. JMeter sends requests to a server through its samplers. To send mail messages using SMTP/SMTPS protocol, SMTP sampler can be used. The below screenshot shows how to add a SMTP sampler.
Once SMTP sampler is added, we need to configure sampler’s properties as shown below.
3) Listener(s) : All the information about the test plans gathered by JMeter can be accessed by one or more Listeners. Listeners can also save the results to a file for later use. While all the listeners operate on the same data set, they provide a different visualization of the data according to the listener. Listener can be added as shown below.
Running the test plan
To run your test plan, select “Start” from the “Run” menu item or press Ctrl+R. When JMeter is running, it shows a small green box at the right hand side of the section just under the menu bar. The numbers to the left of the green box are the number of active threads / total number of threads.
Results can be seen in JMeter window by selecting the required listener.
In case you decide to save the results in a file, simply provide a file location before running the test plan as shown below.
It’s the best time to make some plans for the long run and it’s time to be happy. I have learn this put up and if I could I wish to counsel you some fascinating things or suggestions. Maybe you could write subsequent articles regarding this article. I want to read even more issues about it!
In this awesome pattern of things you actually receive a B- with regard to effort and hard work. Where exactly you misplaced everybody was in your particulars. You know, people say, the devil is in the details… And that couldn’t be much more correct in this article. Having said that, permit me inform you precisely what did deliver the results. Your article (parts of it) is rather powerful which is most likely why I am taking the effort in order to opine. I do not really make it a regular habit of doing that. 2nd, whilst I can certainly notice a leaps in reason you come up with, I am definitely not convinced of just how you seem to connect the points which make your final result. For right now I shall subscribe to your issue but wish in the near future you actually connect your dots much better.