Skip to main content

Basic Web Performance Testing With JMeter and Gatling


In this post I'll give a quick way to get some basic web performance metrics using both JMeter and Gatling.

JMeter is a well known, open source, Java based tool for performance testing. It has a lot of features, and can be a little confusing at first. Scripts (aka Test Plans), are XML documents, edited using the JMeter GUI.  There are lots of options, supports a wide variety of protocols, and produces some OK looking graphs and reports.

Gatling is a lesser known tool, but I really like it. It's a Scala based tool, with scripts written in a nice DSL. While the scripts require some basic Scala, they are fairly easy to understand and modify. The output is a nice looking, interactive, HTML page.


Below are the basic metrics gathered by both JMeter and Gatling. If you are just starting performance testing, these might be a good starting point.

Response Time – Difference between time when request was sent and time when response has been fully received

Latency – JMeter and Gatling define latency as the difference between time when request was sent and when response has started to be received, which includes the time the server spends processing the request.

Throughput – JMeter and Gatling define throughput as the number of requests per second. It is a measure of the load placed on the server during the test.


Setting up both JMeter and Gatling  is simply a matter of installing Java, and downloading the JMeter and Gatling binaries to your machine.

JMeter 2.11 can be downloaded here. Gatling 1.5.5 binaries can be downloaded here.

I've used the Oracle JDK 7 to run both JMeter and Gatling. The JDK can be downloaded here.


Setting up a simple test plan in JMeter is pretty straightforward.

  1. Add Thread Group. Right Click 'Test Plan', Add 'Threads (Users)'->'Thread Group'. 
  2. Configure number of threads (users) on the Thread Group. (e.g. set to 10 to simulate 10 users)
  3. Configure the ramp up period of the users on the Thread Group (e.g. set to 5 to ramp up the given number of users over a 5 minute period)
  4. Configure the loop count on the Thread Group (e.g. set to 10 for each user to repeat the action 10 times). Check 'Forever' if you want each user to constantly repeat the action indefinitely (simulating the user constantly clicking the refresh button).
  5. Add HTTP Request Sampler. Right Click the new Thread Group, then click Add->Sampler->HTTP Request.
  6. Configure HTTP Request Server or IP. Leave out protocol, and point at the root. (
  7. Configure HTTP Request Path. Set to '/' the HTTP Request Server or IP is the full URL you want to hit. Otherwise, append the relative path of the URL you want to hit (relative to the server)
  8. Add listeners to the Thread Group. For example, you might want tabular results, graph results, response time graph, or summary report. I'd recommend at least 'View Results in Table', along with 'Graph Results'. All listeners are added the same way. Right click the Thread Group, click Add->Listener then pick the listener you want to add.
  9. Save the test plan (from the File Menu).

When the test plan is complete, run it by pressing the green run button in the toolbar.

View Results in Table

Graph Results


There is no GUI for editing Gatling scripts, other than a plain old text editor or your IDE of choice.

The first time using Gatling, you might want to use the Gatling Recorder.

Gatling Recorder

  1. Fire up the recorder from the Gatling\bin folder
  2. Configure the proxy server ports (defaults are HTTP 8000, HTTPS 8001)
  3. Configure the Java package that will contain the output Java Class containing the Gatling script (or leave blank for no package)
  4. Configure the class name, to give a descriptive name for the Gatling Simulation, or leave it as the default
  5. Click Start
  6. Configure your browser to use the Gatling proxy server
  7. Load up the page you want to record in your browser
  8. Once your done performing the actions you want the script to take, click the Stop and Save button on the recorder. 
  9. A new Gatling script will be created in the Gatling\user-files\simulations\ folder.

Sample Script

Here's a simple example of a Gatling script.It ramps up 10 users over 5 seconds, where each user loads 10 times each, for total of 100 page requests.

package jterry
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import com.excilys.ebi.gatling.jdbc.Predef._
import com.excilys.ebi.gatling.http.Headers.Names._
import akka.util.duration._
import bootstrap._
import assertions._

class Blog extends Simulation {

 val httpConf = httpConfig
   .userAgentHeader("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0")

 val scn = scenario("Jerome's Blog")
  .repeat(10) {

 setUp(scn.users(10).ramp(5 seconds).protocolConfig(httpConf))

 Running Gatling Scripts

To run a Gatling script, you use the Gatling command in the Gatling\bin folder.  If you run Gatling without any options, it will prompt you to select the Simulation you want to run. However, if you know the package and class name, you can use the command "Gatling -s [package].[Class]".

After running a simulation, the HTML results are saved to Gatling\results\


This was a very basic guide to setting up and running JMeter and Gatling for the first time, assuming little or no previous experience with performance testing or these tools.

With a little bit of effort, it's not too much trouble to get some basic performance metrics on a single web page, including response time, latency and throughput.


  1. The blog gave me idea about the web performance testing my sincere thanks for sharing this post and please continue to share this kind of post
    Software Testing Training in Chennai

  2. Nice and Valuable information you explained in this article I loved it more, It useful for me a lot. Bookmarked your site.
    Java Online Training

  3. Interesting and informative article.. very useful to me.. thanks for sharing your wonderful ideas.. please keep on updating..

    Software Testing Training in chennai

  4. Interesting blog post.This blog shows that you have a great future as a content writer.waiting for more updates...
    Digital Marketing Company in India

  5. Excellent post on Java!!!Everyone are repeating the same concept in their blog, but here I get a chance to know new things in Java programming language. I will also suggest your content to my friends to know about recent features of Java.


    Best Java Training in Chennai |
    J2EE Training in Chennai

  6. Nice blog !!! I agree with your points, Big Data Hadoop technology is ruling the whole organization to handle data in efficient manner. HDFS and Map reduce helps the developer in different ways to manage data.


    Hadoop Training in Chennai |
    Big Data Training in Chennai


  7. Testing an application is become essential for any product to get an effective result. Your post help you to gain more info on Selenium Testing

    Selenium Training in chennai |
    Selenium Training

  8. Thanks for sharing this useful info with us, this post will be useful for beginners those who wish to learn Jmeter. keep on sharing.Jmeter Training Course |
    Jmeter Training Institute in Chennai |
    Jmeter Training |
    Best Jmeter Training Institute in chennai

  9. There are so many useful information in your post, I like it all the time. And I want to share this boost app ranking with you, you can take a look. This is very useful.

  10. Appreciation for really being thoughtful and also for deciding on
    certain marvelous guides most people really want to be aware of.

    java training in chennai

    java training in bangalore

  11. Thanks for sharing this useful info with us...

    software testing course online

  12. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.

    Best Java Training Institute Chennai

    Java Training Institute Bangalore

  13. Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.

  14. Ciitnoida provides Core and java training institute in

    . We have a team of experienced Java professionals who help our students learn Java with the help of Live Base Projects. The object-

    oriented, java training in noida , class-based build

    of Java has made it one of most popular programming languages and the demand of professionals with certification in Advance Java training is at an

    all-time high not just in India but foreign countries too.

    By helping our students understand the fundamentals and Advance concepts of Java, we prepare them for a successful programming career. With over 13

    years of sound experience, we have successfully trained hundreds of students in Noida and have been able to turn ourselves into an institute for best

    Java training in Noida.

    java training institute in noida
    java training in noida

  15. The blog gave me thought regarding the web execution testing my genuine a debt of gratitude is in order for sharing this post and please keep on sharing this sort of post

  16. Intriguing and educational article.exceptionally helpful to me..a debt of gratitude is in order for sharing your great thoughts.. kindly continue refreshing.

    Article Submission sites| Latest Updates| Technology

  17. This comment has been removed by the author.

  18. Very interesting content which helps me to get the in depth knowledge about the technology. keep sharing... Thanks you
    guest posting sites
    technical updates

  19. Great post. Wonderful information and really very much useful. Thanks for sharing and keep updating.
    java training in chennai
    java course in chennai

  20. This was an nice and amazing and the given contents were very useful and the precision has given here is good.

    Bigdata AnalyticsTraining in Bangalore

  21. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.

    RPA Training in Chennai | Blue Prism Training in Chennai

  22. Thanks you so much for your tips and content, This is great one article,likely its very useful to me. Once again say thanks.

    Selenium Training in Chennai | Selenium Course in Chennai

  23. Best institute for 3d Animation and Multimedia Course training Classes

    Best institute for 3d Animation and Multimedia

    Best institute for 3d Animation Course training Classes in Noida- webtrackker Is providing the 3d Animation and Multimedia training in noida with 100% placement supports. for more call - 8802820025.

    3D Animation Training in Noida

    Company Address:

    Webtrackker Technology

    C- 67, Sector- 63, Noida

    Phone: 01204330760, 8802820025



  24. This comment has been removed by the author.

  25. Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great

    content of different kinds of the valuable information's.

    angularjs Training in bangalore

    angularjs Training in btm

    angularjs Training in electronic-city

    angularjs Training in online

    angularjs Training in marathahalli


Post a Comment

Popular posts from this blog

Generating Java Mixed Mode Flame Graphs

Overview I've seen Brendan Gregg's talk on generating mixed-mode flame graphs and I wanted to reproduce those flamegraphs for myself. Setting up the tools is a little bit of work, so I wanted to capture those steps. Check out the Java in Flames post on the Netflix blog for more information.

I've created github repo (  that contains the scripts used to get this going, including a Vagrantfile, and JMeter Test Plan.

Here's a flame graph I generated while applying load (via JMeter) to the basic arithmetic Tomcat sample application. All the green stacks are Java code, red stacks are kernel code, and yellow stacks are C++ code. The big green pile on the right is all the Tomcat Java code that's being run.

Tools Here's the technologies I used (I'm writing this on a Mac).
VirtualBox 5.1.12Vagrant 1.9.1bento/ubuntu-16.04 (kernel 4.4.0-38)Tomcat 7.0.68JMeter 3.1OpenJDK 8 1.8.111linux-tools-4.4.0-38linux-tools-commonBrendan Gregg's Fla…

Multi Threaded NUnit Tests

Recently I needed to reproduce an Entity Framework deadlock issue. The test needed to run in NUnit, and involved firing off two separate threads. The trouble is that in NUnit, exceptions in threads terminate the parent thread without failing the test.

For example, here's a test that starts two threads: the first thread simply logs to the console, while the other thread turfs an exception. What I expected was that this test should fail. However, the test actually passes.

readonly ThreadStart[] delegates = { () => { Console.WriteLine("Nothing to see here"); }, () => { throw new InvalidOperationException("Blow up"); } }; [Test] public void SimpleMultiThreading() { var threads = delegates.Select(d => new Thread(d)).ToList(); foreach (var t in threads) { t.Start(); } foreach (var t in threads) { t.Join(); } }
Peter Provost posted an article that describes how to make this test fail. It works…