{"id":1683,"date":"2020-09-10T09:32:54","date_gmt":"2020-09-10T09:32:54","guid":{"rendered":"https:\/\/loadfocus.com\/blog\/?p=1683"},"modified":"2021-12-21T11:57:51","modified_gmt":"2021-12-21T11:57:51","slug":"how-to-increase-heap-size-in-jmeter","status":"publish","type":"post","link":"https:\/\/loadfocus.com\/blog\/2020\/09\/how-to-increase-heap-size-in-jmeter","title":{"rendered":"How to Increase Heap Size in JMeter?"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">minutes read<\/span><\/span>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p class=\"lead\">Why is Apache JMeter very slow when creating and running load tests?<\/p><\/blockquote>\n\n\n\n<p>If you just downloaded and opened <strong>Apache JMeter<\/strong> and the UI it feels very slow, here are some items you can follow to make Apache Jmeter GUI move faster.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Increase the Apache JMeter Heap Size<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>Apache JMeter<\/strong> is a Java application, this means you have to increase the Java Virtual Machine initial heap size and maximum heap size<\/li><li>The easiest way to increase the heap sizes is to edit the <code>jmeter.bat<\/code> file and add the following line:<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"678\" src=\"https:\/\/loadfocus.com\/blog\/wp-content\/uploads\/Screenshot-2021-12-21-at-13.54.34-1280x678.png\" alt=\"\" class=\"wp-image-2321\" srcset=\"https:\/\/loadfocus.com\/blog\/wp-content\/uploads\/Screenshot-2021-12-21-at-13.54.34-1280x678.png 1280w, https:\/\/loadfocus.com\/blog\/wp-content\/uploads\/Screenshot-2021-12-21-at-13.54.34-800x424.png 800w, https:\/\/loadfocus.com\/blog\/wp-content\/uploads\/Screenshot-2021-12-21-at-13.54.34-600x318.png 600w, https:\/\/loadfocus.com\/blog\/wp-content\/uploads\/Screenshot-2021-12-21-at-13.54.34-768x407.png 768w, https:\/\/loadfocus.com\/blog\/wp-content\/uploads\/Screenshot-2021-12-21-at-13.54.34.png 1428w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><figcaption>JMeter.bat file to edit in order to change the heap size<\/figcaption><\/figure>\n\n\n           \r\n            <div class=\"onp-locker-call\" style=\"display: none;\" data-lock-id=\"onpLock376924\">\r\n                <p><\/p>\n<p><strong>Find the following line:<\/strong><\/p>\n<pre># This is the base heap size -- you may increase or decrease it to fit your<br \/># system's memory availability:<br \/>: \"${HEAP:=\"-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m\"}\"<\/pre>\n<p><strong>or if that is missing, add the line below:<\/strong><\/p>\n\n\n<pre class=\"wp-block-preformatted\">set HEAP=-Xms2g -Xmx2g -XX:MaxMetaspaceSize=12g<\/pre>\n\n\n\n<p>Save the changes made in the <code>jmeter.bat<\/code> file and restart JMeter. Now creating JMeter test scripts will feel much faster.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Run your JMeter load test in non-GUI mode<\/h2>\n\n\n\n<p>More details on how to run your JMeter test in non-GUI mode can be found <a href=\"https:\/\/jmeter.apache.org\/usermanual\/get-started.html#non_gui\">here<\/a>, however here is a quick example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">jmeter -n -t my_test.jmx -l log.jtl -H my.proxy.server -P 8000<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Disable JMeter listeners during test execution<\/h2>\n\n\n\n<p>Most likely you don&#8217;t need the listeners during test execution, so you can easily disabled them by pressing <code>Ctrl\/Cmd + T<\/code>  and have the disabled during the test run.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Monitor machine resources CPU, Memory, Network <\/h2>\n\n\n\n<p>You can easily monitor the resources of the machine where JMeter load tests are running upon by using a plugin:<a href=\"https:\/\/jmeter-plugins.org\/wiki\/PerfMon\/\" rel=\"nofollow\"> JMeter PerfMon plugin<\/a>. Check more details on <a href=\"https:\/\/loadfocus.com\/blog\/2020\/09\/how-to-install-extra-plugins-in-jmeter-using-the-plugins-manager\/\" title=\"How to install extra plugins in JMeter using the Plugins Manager?\">how to install JMeter plugins<\/a> in our other post.<\/p>\n\n\n\n<p>By now, your JMeter test creation should feel much faster and your non-GUI performance tests should behave better.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Update Java to the Latest Version<\/h2>\n\n\n\n<p>Check which version of Java you have installed on your machine, for Mac users you can check by typing in the terminal the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/usr\/libexec\/java_home -V<\/code><\/pre>\n\n\n\n<p>Written by <a href=\"https:\/\/coursinator.com\/instructor\/bogdan-vazzolla\" class=\"broken_link\">Bogdan Vazzolla<\/a>.<\/p>\n\n\n<p><\/p>\r\n            <\/div>\r\n         \r\n\r\n        \n\n\n<p>With <a href=\"https:\/\/loadfocus.com\/jmeter-load-testing\">JMeter Cloud Load Testing Tool<\/a> from <a href=\"https:\/\/loadfocus.com\/\">LoadFocus<\/a>, you can upload your Apache JMeter test scripts (.jmx files), run and analyse JMeter results from multiple world locations, everything in an easy to use UI.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">minutes read<\/span><\/span>Why is Apache JMeter very slow when creating and running load tests? If you just downloaded and opened Apache JMeter and the UI it feels very slow, here are some items you can follow to make Apache Jmeter GUI move faster. Increase the Apache JMeter Heap Size Apache JMeter is a Java application, this means&#8230;  <a href=\"https:\/\/loadfocus.com\/blog\/2020\/09\/how-to-increase-heap-size-in-jmeter\" class=\"more-link\" title=\"Read How to Increase Heap Size in JMeter?\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":1614,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,9,48],"tags":[290,289],"class_list":["post-1683","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apache-jmeter","category-load-testing","category-test-automation","tag-jmeter-gui-is-very-slow","tag-jmeter-heap-size"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/posts\/1683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/comments?post=1683"}],"version-history":[{"count":0,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/posts\/1683\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/media\/1614"}],"wp:attachment":[{"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/media?parent=1683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/categories?post=1683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/tags?post=1683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}