{"id":13351,"date":"2014-05-12T10:49:56","date_gmt":"2014-05-12T05:19:56","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=13351"},"modified":"2016-12-19T14:54:38","modified_gmt":"2016-12-19T09:24:38","slug":"load-testing-an-smtp-application-using-jmeter-postal","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/load-testing-an-smtp-application-using-jmeter-postal\/","title":{"rendered":"Load Testing an SMTP application using JMeter &amp; Postal"},"content":{"rendered":"<p>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 :<\/p>\n<p>1) Postal<br \/>\n2) JMeter<\/p>\n<p><strong>Postal<\/strong> 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.<\/p>\n<p style=\"margin-bottom: 10px\">In ubuntu, we can install Postal by running the following command in the terminal.<\/p>\n<p>[shell]sudo apt-get install postal[\/shell]<\/p>\n<p style=\"margin-bottom: 10px\">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&#8217;ll be setting it up to send a maximum of 1000 messages per minute.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/postal2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13352\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/postal2.png\" alt=\"\" width=\"511\" height=\"20\" \/><\/a><\/p>\n<p>There are some options that we need to specify while running the Postal command.<\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"padding: 10px;border: 1px solid #000\">Options<\/td>\n<td style=\"padding: 10px;border: 1px solid #000;width: 555px\">Description<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px;border: 1px solid #000\">-m&lt;3&gt;<\/td>\n<td style=\"padding: 10px;border: 1px solid #000\">Specifies maximum message body size in Kilobytes (random size selected for each message from 0-specified value).<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px;border: 1px solid #000\">-t&lt;10&gt;<\/td>\n<td style=\"padding: 10px;border: 1px solid #000\">Specifies the number of threads that should be created for separate connection attempts (defaults to 1)<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px;border: 1px solid #000\">-c&lt;100&gt;<\/td>\n<td style=\"padding: 10px;border: 1px solid #000\">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.<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px;border: 1px solid #000\">-r&lt;100&gt;<\/td>\n<td style=\"padding: 10px;border: 1px solid #000\">Specifies maximum number of messages per minute, defaults to 24000. Used to limit the throughput of the system.<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px;border: 1px solid #000\">-f &lt;sender&gt;<\/td>\n<td style=\"padding: 10px;border: 1px solid #000\">Specifies a file containing the envelope sender of the message &amp; a list of users that will be in the \u2018From:\u2019 field.<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px;border: 1px solid #000\">[localhost]&lt;25000&gt;<\/td>\n<td style=\"padding: 10px;border: 1px solid #000\">Specifies the IP address\/name of the mail server to send the mail to (localhost &#8211; for connecting to the same machine). \u2018[ ]\u2019 can be omitted if using default port &#8211; 25. 25000 specifies the port number.<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px;border: 1px solid #000\">receivers<\/td>\n<td style=\"padding: 10px;border: 1px solid #000\">Specifies a file containing a list of user\u2019s email addresses that can be just user-names or fully qualified email addresses (i.e. user@domain)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>You can see a list of all the available options <a title=\"postal options\" href=\"http:\/\/www.google.com\/url?q=http%3A%2F%2Fmanpages.ubuntu.com%2Fmanpages%2Fhardy%2Fen%2Fman8%2Fpostal.8.html%23contenttoc5&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNEidzovc3qCkROrylRwvmldhrRyhg\" target=\"_blank\">here<\/a><\/p>\n<p style=\"margin-bottom: 10px\">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.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/postal1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13353\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/postal1.png\" alt=\"\" width=\"572\" height=\"91\" \/><\/a><\/p>\n<p><a title=\"JMeter\" href=\"https:\/\/jmeter.apache.org\/\" target=\"_blank\"><strong>JMeter<\/strong><\/a> 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.<\/p>\n<p><a title=\"Download JMeter\" href=\"https:\/\/jmeter.apache.org\/download_jmeter.cgi\" target=\"_blank\">Download<\/a> the zip file and extract it. To run JMeter, execute the script file located in the bin folder.<\/p>\n<p>[bash]<br \/>\nsudo bin\/.jmeter<br \/>\n[\/bash]<\/p>\n<p style=\"margin-bottom: 10px\">This will open the JMeter window as shown below.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/Apache-JMeter-2.11-r1554548_178.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13356\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/Apache-JMeter-2.11-r1554548_178.png\" alt=\"\" width=\"550\" height=\"300\" \/><\/a><\/p>\n<p>Here we see two tabs, namely :<br \/>\n1. Test Plan,<br \/>\n2. WorkBench<\/p>\n<p><strong>Building a Test Plan<\/strong><br \/>\nA <strong>Test Plan<\/strong> describes a series of steps JMeter will execute when run. To build a test plan, we need to add following elements to it :<\/p>\n<p style=\"margin-bottom: 10px\">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.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/build-test-plan_add-thread.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-13521\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/build-test-plan_add-thread.png\" alt=\"\" width=\"550\" height=\"310\" \/><\/a><\/p>\n<p style=\"margin-bottom: 10px\">Configure values for the thread properties in the thread group as shown below.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/build-test-plan_configure-thread-properties.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13358\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/build-test-plan_configure-thread-properties.png\" alt=\"\" width=\"550\" height=\"260\" \/><\/a><\/p>\n<p style=\"margin-bottom: 10px\">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.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/build-test-plan_add-SMTP-sampler-to-thread-group.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13359\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/build-test-plan_add-SMTP-sampler-to-thread-group.png\" alt=\"\" width=\"550\" height=\"307\" \/><\/a><\/p>\n<p style=\"margin-bottom: 10px\">Once SMTP sampler is added, we need to configure sampler\u2019s properties as shown below.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/build-test-plan_configure-sampler-properties.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13360\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/build-test-plan_configure-sampler-properties.png\" alt=\"\" width=\"550\" height=\"310\" \/><\/a><\/p>\n<p style=\"margin-bottom: 10px\">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.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/build-test-plan_add-listeners-to-thread-group.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13361\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/build-test-plan_add-listeners-to-thread-group.png\" alt=\"\" width=\"550\" height=\"315\" \/><\/a><\/p>\n<p><strong>Running the test plan<\/strong><br \/>\nTo run your test plan, select &#8220;Start&#8221; from the &#8220;Run&#8221; 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.<\/p>\n<p style=\"margin-bottom: 10px\">Results can be seen in JMeter window by selecting the required listener.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/results-_-aggregate-report.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13362\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/results-_-aggregate-report.png\" alt=\"\" width=\"550\" height=\"130\" \/><\/a><\/p>\n<p style=\"margin-bottom: 10px\">In case you decide to save the results in a file, simply provide a file location before running the test plan as shown below.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/Test-Plan-final.jmx-home-komal-Documents-StrongView-MS-load-testing-results-Test-Plan-final.jmx-Apache-JMeter-2.11-r1554548_188.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13355\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/05\/Test-Plan-final.jmx-home-komal-Documents-StrongView-MS-load-testing-results-Test-Plan-final.jmx-Apache-JMeter-2.11-r1554548_188.png\" alt=\"\" width=\"550\" height=\"320\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":73,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":249},"categories":[7],"tags":[696,698,1422,1421],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/13351"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/73"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=13351"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/13351\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=13351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=13351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=13351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}