Test your Web Application’s Performance


Picture:Clock Published on April 23rd, 2007 in Web, jMeter

Apache jMeter LogoIs it just me, or is like everyone these days developing some kind of web application on the side? Web applications really have arrived and are rapidly becoming even more popular than traditional desktop applications. There are numerous reasons why that’s the case:

  • No installation on client’s architecture needed (no maintenance on the client-side!)
  • Your application is always up to date
  • You can use a various billing models (monthly, yearly, even per usage)

But shifting away from an employee’s personal desktop or a local network server to some kind of web server (or a load-balanced server-farm) can cause some serious problems. Web apps tend to slow down the more people use them. One way to fight this (not directly, though), is using a sophisticated test tool. The testing itself won’t fix your web app’s performance issues, but it will provide you with a good and reliable way to measure performance while you’re tuning some aspects like the web or database server’s configuration. Getting more out of your servers really depends on how accurately you can measure the changes you’ve made to various configurations.

This is where Apache Jakarta’s jMeter comes into play. Commercial testing applications easily cost thousands of dollars and are often a nightmare to use, thus requiring training courses for their users to attend which make them even more expensive. Apache’s jMeter is an open-source application providing you with most features you will ever need to test your servers or applications. It’s usability also leaves some space for improvement, but hey, at least it’s free! In this tutorial we will create a simple, but effective web-stress test for an URL. JMeter is capable of doing a lot more than that, you can even test your web application’s GUI and the GUI’s results (although I recommend the much easier to use Badboy for GUI testing purposes). Here’s a screenshot of Badboy (only available for Windows):
fsscreenshot

JMeter in my opinion is perfect for stress-testing your web app, so let’s take a look at the steps to do just that:

  1. Download and install jMeter from Apache’s Website here. JMeter is Java application, so it will work on a wide variety of operating systems (get the binary zip, it should work for all platforms and make sure you’re running a decent Java Virtual Machine). I recommend not to use Windows for serious stress testing of higher-end servers due to Windows’ TCP/IP concurrent connections limitations.
  2. After firing up jMeter, you will be greeted by the following screen, change the name of “Test Plan” to something more meaningful.
    1
  3. Now add a Thread Group, which is just what it says, a group of threads, which we will use, to access our web app with simultaneous connections and thus creating the load.
    2
  4. After we added a Thread Group, we need to adjust it to our needs. Number of Threads specifies the amount of concurrent users. The ramp-up period specifies the period after which the full amount of users will access the web application. The loop count indicates how many cycles with those settings above should be run. In our example (50 * 10) this results in 500 users. This is a good amount to start with, it provides you with good details about your server’s performance but shouldn’t make it crash.
    3
  5. Let’s add an HTTP request sampler. As you can see, jMeter shows us a lot of other request sampler’s as well, like ftp, jMeter really shows, how flexible it is and that you can even stress-test ftp servers without much effort!
    4
  6. As we have added an HTTP request sampler, we now need to configure it. Under “server name” enter your URL (without the HTTP part). If you want to check the root folder of that URL, just enter forward slash (“/”) as the path.
    5
  7. The HTTP request sample is complete. We will now add a “Gaussian Random Timer” to the HTTP request. This will time the breaks between the connections in a more random fashion, so reflects the real world a lot better. Configure the Gaussian Random Timer according to the screenshot.
    67
  8. To see what’s happening, we need some reports! Let’s add a report with graphic visualization: Select “Graph Results”.
    8
  9. To see raw numbers (which is also great if you want to export your data to Excel and create your own custom reports and graphs, add “Aggregate Report”.
    9
  10. We’re done building our test plan. Hit Ctrl + R and run the thing! Your reports should look something like this:
    11

I hope this first tutorial really gets you started with jMeter. I’m planning on posting a lot more tutorials and tips about jMeter in the near future as I get to know it better myself. If you have any questions or want to give me some feedback, go ahead and post a comment.


Share This

Trackback URL for this post:
http://www.yatblog.com/2007/04/23/test-your-web-applications-performance/trackback/


12 comments

    Mike April 26th, 2007

    Interesting. I wanted was looking into something like this. Nice article.

    Submitted into queue @ tweako.com

    Jawed Ali April 27th, 2007

    I want to put this link on http://www.osjp.org.

    Arvind Nanda April 30th, 2007

    Hi,

    Thanks for your tips. it really help me for initial level. But can you provide some more details like how can i record my application flow. i mean in HTTP request we just add the path but after that in my application ther is no. of steps. So how can i test or record my application step to test it.

    Thanks,
    Arvind

    MGilly May 8th, 2007

    This is terrific! I look forward to more posts like this. In particular, could you talk about evaluating the resulting graphs from such tests? Thanks!

    ydak May 17th, 2007

    Hi,
    Firstly Thank you very much for providing us with a real time example. I am really thankful to the author of this article because i learnt the basics of JMeter just by following the steps illustrated in the above example. It would be more helpful if you can explain how to analyze the graphs(results),
    how to record if there’s is any such method and Finally the way the example is explained is simply superb.
    Regards
    ydak.

    Raja September 3rd, 2007

    Need more information about Jmeter, where can i find ?

    Sandeep September 19th, 2007

    Hello sir,

    i have downloaded jmeter2.2 and installed but i dont know how to use it for our web application, please can u tell me how to use this for testing jsp,servlets,html pages, i mean our application is stored in webapps folder of tomcat with name Viewer and with in this Viewer we have login.jsp, other jsp,xml,xsl,images and servlet class files in class folder. so how can i test our aplication using jmeter.

    Please let me know your feedback.

    with regards
    sandeep.

    sandeep September 19th, 2007

    Hi,

    i forget to tell my mail id:

    sandeep.kumarappa@datafarminc.com

    sandeep_mk2003@yahoo.com

    Harbinder Singh January 17th, 2008

    I have done all whatever u have given in this article. My problem is how do I evaluate the results from the listeners like aggregate report, graphs, results tree etc. I want detailed knowledge of all these. Please help.

    [...] as input test files in jMeter. jMeter’s wiki has a link to a step-by-step tutorial entitled Test your Web Application’s Performance on how to use BadBoy and jMeter. With this method, we have worked with our member campuses to [...]

    Rama Krishna Bagam April 8th, 2008

    Thank u for the article…its really good one

    Bandana August 13th, 2008

    Hi,
    The above article is really helpful for beginners. I want to measure the response time taken for log in by multiple users to my web application (jsp pages) , how can I do this? If anybody has any link, please provide it for further information. I tried with HTTP authorization manager, but if I give wrong user name and password, still I am getting, successful response code (200) for all request :-(? Please help me out.

    Regards

Shout it out!