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 :
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.
|Specifies maximum message body size in Kilobytes (random size selected for each message from 0-specified value).
|Specifies the number of threads that should be created for separate connection attempts (defaults to 1)
|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.
|Specifies maximum number of messages per minute, defaults to 24000. Used to limit the throughput of the system.
|Specifies a file containing the envelope sender of the message & a list of users that will be in the ‘From:’ field.
|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.
|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.
This will open the JMeter window as shown below.
Here we see two tabs, namely :
1. Test Plan,
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.