JMeter OutOfMemoryError

后端 未结 11 1894
北荒
北荒 2020-12-25 14:20

I am facing below OutOfMemor errors, and JMeter stops working....

java.lang.OutOfMemoryError: Java heap space Dumping heap to
    java_pid4412.hprof ... Heap         


        
相关标签:
11条回答
  • 2020-12-25 15:16

    You should check whether you're not using a tree result listener during your tests with many users.

    Check jmeter best practices to avoid this kind of issues.

    Regards

    0 讨论(0)
  • 2020-12-25 15:19

    A lot of these answers are out-of-date. Currently using jmeter v5.1.1 r1855137:

    # Set var to increase available memory
    JVM_ARGS="-Xms2048m -Xmx4096m"
    # Run jmeter via sh script, e.g.:
    /jmeter/5.1.1/libexec/bin/jmeter.sh -n -t testfile.jmx -l results.jtl -j log.txt
    

    You can verify that the increase in memory is available via the log.txt file, which will show the following using the values above:

    INFO o.a.j.JMeter: Max memory     =3817865216
    
    0 讨论(0)
  • 2020-12-25 15:19

    Adjust the heap size as mentioned in the other answers and also take some best practices into account

    • When running a test (not when validating of course) use the non-gui mode
    • Disable any heavy listener such as View Result Tree but instead use a Simple Data Writer and analyze your data afterwards

    These 2 items will already greatly increase your performance and heap size usage

    0 讨论(0)
  • 2020-12-25 15:24

    How much memory have you allocated for the JVM? Somewhere aroung 512 MB?

    The configuration is

    java -Xms<initial heap size> -Xmx<maximum heap size>
    
    0 讨论(0)
  • 2020-12-25 15:25

    Your Heap dump shows that you are using default JMeter settings of 512 Mo. so even if you have 16gb you are not using them.

    Replace default JVM optional in jmeter.bat to the right size:

    set HEAP=-server -Xms768m -Xmx768m -Xss128k 
    
    set NEW=-XX:NewSize=1024m -XX:MaxNewSize=1024m
    

    Also look at:

    • http://wiki.apache.org/jmeter/JMeterFAQ#JMeter_keeps_getting_.22Out_of_Memory.22_errors.__What_can_I_do.3F

    • http://www.ubik-ingenierie.com/blog/jmeter_performance_tuning_tips/

    0 讨论(0)
提交回复
热议问题