{"id":11619,"date":"2019-11-13T00:29:43","date_gmt":"2019-11-13T00:29:43","guid":{"rendered":"http:\/\/abstracta.us\/blog\/?p=11619"},"modified":"2025-05-05T21:23:10","modified_gmt":"2025-05-05T21:23:10","slug":"difference-between-jmeter4-jmeter5","status":"publish","type":"post","link":"https:\/\/abstracta.us\/blog\/performance-testing\/difference-between-jmeter4-jmeter5\/","title":{"rendered":"What You Need to Know About the Difference Between JMeter 4 and 5"},"content":{"rendered":"<h1><span style=\"font-weight: 400;\">Using JMeter 5? Understand this key difference that will impact how you set up your tests&#8230;<\/span><\/h1>\n<p><img decoding=\"async\" class=\"aligncenter size-large wp-image-11627\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2019\/11\/tristan-gassert-ulTMKa88rEM-unsplash-min-1024x683.jpg\" alt=\"hand holding a clock\" width=\"1024\" height=\"683\" \/><\/p>\n<p><span style=\"font-weight: 400;\">At Abstracta, we\u2019ve been experimenting recently with JMeter 4 and 5 (the latest versions to date) and<\/span><b> we found a very important difference in the way they behave<\/b><span style=\"font-weight: 400;\"> and it\u2019s important to know it in order to simulate load the way you\u2019d like.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Basically, <\/span><b>the connections in JMeter 4 are kept open between iterations and in JMeter 5 they are completely restored<\/b><span style=\"font-weight: 400;\">, which leads to two implications that will drastically change test results:\u00a0<\/span><\/p>\n<p><i><span style=\"font-weight: 400;\">On one hand, JMeter 5 requires more resources to execute, and on the other, the registered response time will be longer than when the connection is reused (as it is in JMeter 4).\u00a0<\/span><\/i><\/p>\n<p><span style=\"font-weight: 400;\">Both consequences are due to the opening of a new connection requiring more resources, which takes more time than using one that\u2019s open already.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In this post, written with the help of my Abstracta colleagues, we\u2019ll tell you how we reached this conclusion and discuss the implications of it for making the decision of how to model your test to simulate your system\u2019s users in the best way.\u00a0<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Experimenting_with_JMeter_5\"><\/span><strong><span style=\"color: #00b674;\">Experimenting with JMeter 5<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">When executing tests with the latest available version of JMeter (5.1), we found that with about 30 virtual users, the use of the load generator CPU was already saturated, reaching 100% for almost the entire execution of the test. We could also see that the response times were high, and consequently, the number of requests per second was low.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To understand why this was happening, after analyzing different things, we wanted to try a previous version to verify if this also was the case. When executing the same test with JMeter 4.0, we found that we had considerably less response time, more requests per second and also less CPU usage than with JMeter 5.1. After a little research, we found that the main difference in this behavior was located in the connection time and when we reviewed the documentation of the changes in JMeter, we came across this:<\/span><\/p>\n<blockquote><p><i><span style=\"font-weight: 400;\">\u201cSince JMeter 5.0, when using default HC4 Implementation, JMeter will reset HTTP state (SSL State + Connections) on each thread group iteration. If you don&#8217;t want this behavior, set httpclient.reset_state_on_thread_group_iteration = false \u201d<\/span><\/i><\/p><\/blockquote>\n<p><span style=\"font-weight: 400;\">(Source: <\/span><a href=\"https:\/\/jmeter.apache.org\/changes_history.html\"><span style=\"font-weight: 400;\">https:\/\/jmeter.apache.org\/changes_history.html<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<p><b>In short: the connection in JMeter 4 is kept open between iterations and not in version 5. This causes the same test in JMeter 5 to have longer response times, lower TPS and need more resources to execute.\u00a0<\/b><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Seeing_the_Difference\"><\/span><strong><span style=\"color: #00b674;\">Seeing the Difference<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Below we can see a comparative table of the results obtained when running the tests with different versions of both JMeter and Java.<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-large wp-image-11651\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2019\/11\/Table1-min-1024x326.png\" alt=\"jmeter table 1\" width=\"1024\" height=\"326\" \/><\/p>\n<p><span style=\"font-weight: 400;\">The script that was used for this test (origDemoblaze.jmx) was created with JMeter version 5.1 and simply consists of a single GET request to the address, <\/span><a href=\"http:\/\/dev.demoblaze.com\/\"><span style=\"font-weight: 400;\">http:\/\/dev.demoblaze.com<\/span><\/a><span style=\"font-weight: 400;\">, followed by a 300 millisecond timer to generate a minimum pause between requests.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Below is <\/span><a href=\"https:\/\/www.federico-toledo.com\/pruebas-de-performance-con-taurus-en-integracion-continua-con-travis-ci\/\"><span style=\"font-weight: 400;\">the YAML code of the Taurus script<\/span><\/a><span style=\"font-weight: 400;\"> from which each JMeter script is generated, in case you also wanted to experiment with it:<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-11622\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2019\/11\/Screen-Shot-2019-11-12-at-4.11.53-PM-min-1-1024x647.png\" alt=\"taurus script YAML code\" width=\"900\" height=\"568\" \/><\/p>\n<p><span style=\"font-weight: 400;\">In the table, you can easily see that the results obtained using version JMeter 4 consumed considerably less of the load generators\u2019 resources and also managed to produce more requests per second and less response time.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For this second comparison table, we remove the 300 millisecond timer and observed the following behaviors:<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-large wp-image-11653\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2019\/11\/Table2-min-1-1024x247.png\" alt=\"jmeter table 2\" width=\"1024\" height=\"247\" \/><\/p>\n<p>Despite not seeing significant improvement in the resource consumption of the load generator this time, we noted that with the use of JMeter 4, the number of requests per second is significantly higher and response times are reduced compared to those obtained with version 5.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_to_Simulate_Your_Desired_Behavior_in_JMeter_5\"><\/span><strong><span style=\"color: #00b674;\">How to Simulate Your Desired Behavior in JMeter 5<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">So, is this big difference something positive or negative? Is the default behavior of JMeter 5 correct?\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It all depends on what we are trying to simulate in each case.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Mainly, we have to think about what is it that simulates every thread we execute with JMeter. A thread will execute a script many times until the test is completed. There are two options, that a thread simulates a user performing the same flow of actions many times (those automated in the script) or that a thread simulates different users who access the system one after another, performing the same flow.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Keep in mind that every browser reuses connections. If the users who are going to access the system are going to perform the same task many times, we really want the connections to be reused (as they are in JMeter 4). If instead we are going to simulate many users, one after another, it\u2019s best not to reuse the connections (the way JMeter 5 does).\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The idea of this change is that each iteration is like starting from scratch, as if it were another user, so one user = one iteration of a thread. In this way, the threads are simply a control of how many active concurrent users we can have.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Anyway, with JMeter 5 we can have the same behavior we had in version 4 using a loop controller within our script or in the newest version of JMeter, activate the checkbox in the Thread Group panel that says \u201cSame user on each iteration\u201d. Below we also leave you a new script with a loop controller added so you can experiment with it:<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-large wp-image-11654\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2019\/11\/Screen-Shot-2019-11-18-at-9.58.23-AM-min-1024x681.png\" alt=\"jmeter script loop controller\" width=\"1024\" height=\"681\" \/><\/p>\n<p><span style=\"font-weight: 400;\">The counterpart <\/span><span style=\"font-weight: 400;\">of this new reset operation \u201cAll connection states for each thread\u201d, limits the number of virtual users that can be run by the same load generator since it consumes more resources from them. This means having to use more load generators in some cases, which increases the cost of execution.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Closing\"><\/span><strong><span style=\"color: #00b674;\">Closing<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">In conclusion, when using JMeter we must be clear about 1) the scenario we want to simulate and 2) the differences in behavior between one version and another in order to make the best decision.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Picking wisely will help us to obtain results that are closer to reality and thus be able to better analyze the performance risks we face.\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<h2><span class=\"ez-toc-section\" id=\"Recommended_for_You\"><\/span><span style=\"font-weight: 400;\">Recommended for You<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><a href=\"http:\/\/abstracta.us\/blog\/performance-testing\/best-time-start-performance-testing\/\">When is the Best Time to Start Performance Testing?<\/a><br \/>\n<a href=\"http:\/\/abstracta.us\/blog\/test-automation\/how-to-quickly-set-up-test-automation-in-cicd\/\">How to Quickly Set Up Test Automation in CI\/CD<\/a><\/p>\n<p>&nbsp;<\/p>\n<p><!-- Go to www.addthis.com\/dashboard to customize your tools --><script src=\"\/\/s7.addthis.com\/js\/300\/addthis_widget.js#pubid=ra-58d80a50fc4f926d\" type=\"text\/javascript\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using JMeter 5? Understand this key difference that will impact how you set up your tests&#8230; At Abstracta, we\u2019ve been experimenting recently with JMeter 4 and 5 (the latest versions to date) and we found a very important difference in the way they behave and&#8230;<\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,61],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.0.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The Key Difference Between JMeter 4 and JMeter 5 | Abstracta<\/title>\n<meta name=\"description\" content=\"Ready to try the new version of JMeter? Before simulating load, know this key difference between jmeter 4 and jmeter 5 that will alter your results.\" \/>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/abstracta.us\/blog\/performance-testing\/difference-between-jmeter4-jmeter5\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Key Difference Between JMeter 4 and JMeter 5 | Abstracta\" \/>\n<meta property=\"og:description\" content=\"Ready to try the new version of JMeter? Before simulating load, know this key difference between jmeter 4 and jmeter 5 that will alter your results.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/abstracta.us\/blog\/performance-testing\/difference-between-jmeter4-jmeter5\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog about AI-powered quality engineering for teams building complex software | Abstracta\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/AbstractaQA\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-13T00:29:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-05T21:23:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/abstracta.us\/wp-content\/uploads\/2019\/11\/jmter4vsjmeter5-min.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"560\" \/>\n\t<meta property=\"og:image:height\" content=\"315\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@AbstractaUS\" \/>\n<meta name=\"twitter:site\" content=\"@AbstractaUS\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/abstracta.us\/blog\/#website\",\"url\":\"https:\/\/abstracta.us\/blog\/\",\"name\":\"Blog about AI-powered quality engineering for teams building complex software | Abstracta\",\"description\":\"AI-powered quality engineering\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/abstracta.us\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/abstracta.us\/blog\/performance-testing\/difference-between-jmeter4-jmeter5\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/abstracta.us\/wp-content\/uploads\/2019\/11\/tristan-gassert-ulTMKa88rEM-unsplash-min-1024x683.jpg\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/abstracta.us\/blog\/performance-testing\/difference-between-jmeter4-jmeter5\/#webpage\",\"url\":\"https:\/\/abstracta.us\/blog\/performance-testing\/difference-between-jmeter4-jmeter5\/\",\"name\":\"The Key Difference Between JMeter 4 and JMeter 5 | Abstracta\",\"isPartOf\":{\"@id\":\"https:\/\/abstracta.us\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/abstracta.us\/blog\/performance-testing\/difference-between-jmeter4-jmeter5\/#primaryimage\"},\"datePublished\":\"2019-11-13T00:29:43+00:00\",\"dateModified\":\"2025-05-05T21:23:10+00:00\",\"author\":{\"@id\":\"https:\/\/abstracta.us\/blog\/#\/schema\/person\/3cc530c545cab16fae6829f65fe4419e\"},\"description\":\"Ready to try the new version of JMeter? Before simulating load, know this key difference between jmeter 4 and jmeter 5 that will alter your results.\",\"breadcrumb\":{\"@id\":\"https:\/\/abstracta.us\/blog\/performance-testing\/difference-between-jmeter4-jmeter5\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/abstracta.us\/blog\/performance-testing\/difference-between-jmeter4-jmeter5\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/abstracta.us\/blog\/performance-testing\/difference-between-jmeter4-jmeter5\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/abstracta.us\/blog\/\",\"url\":\"https:\/\/abstracta.us\/blog\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/abstracta.us\/blog\/performance-testing\/\",\"url\":\"https:\/\/abstracta.us\/blog\/performance-testing\/\",\"name\":\"Performance Testing\"}},{\"@type\":\"ListItem\",\"position\":3,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/abstracta.us\/blog\/performance-testing\/difference-between-jmeter4-jmeter5\/\",\"url\":\"https:\/\/abstracta.us\/blog\/performance-testing\/difference-between-jmeter4-jmeter5\/\",\"name\":\"What You Need to Know About the Difference Between JMeter 4 and 5\"}}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/abstracta.us\/blog\/#\/schema\/person\/3cc530c545cab16fae6829f65fe4419e\",\"name\":\"Abstracta Team\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/abstracta.us\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6cab9c9f3dec946bd8867fdb2abbd10a?s=96&d=blank&r=g\",\"caption\":\"Abstracta Team\"},\"description\":\"We are a technology solutions company specializing in software testing, custom software development, and AI-driven software solutions. We provide top-notch, holistic solutions to enable continuous delivery of high-quality software. Our purpose is to co-create first class software, generating opportunities for development in our communities to improve people's quality of life. Organizations such as BBVA Financial Group, CA Technologies and Shutterfly turn to us for comprehensive quality solutions, from rigorous testing to innovative AI copilots and bespoke software development. Sharing our learnings with the community is rooted in our values. That is why we believe in collaborating with the IT community by sharing quality content, courses, and promoting thought leadership events. Recognized with several awards, we are committed to quality, innovation, and customer satisfaction. Our experienced team, dedicated to continuous learning and improvement, has earned the trust of numerous clients worldwide, from startups to Fortune 500 companies. We are a fast-growing company, and we are looking for proactive and talented people, who can assume responsibilities, bring new ideas, and who are as excited as we are about our mission of building high-quality software. If you are interested in joining the team, apply here https:\/\/abstracta.us\/why-us\/careers.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/posts\/11619"}],"collection":[{"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/comments?post=11619"}],"version-history":[{"count":7,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/posts\/11619\/revisions"}],"predecessor-version":[{"id":11655,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/posts\/11619\/revisions\/11655"}],"wp:attachment":[{"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/media?parent=11619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/categories?post=11619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/tags?post=11619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}