gpt4 book ai didi

java - jmeter中的堆设置程序

转载 作者:行者123 更新时间:2023-11-30 02:03:22 26 4
gpt4 key购买 nike

为什么服务器可用内存只有1.5G左右,但是在jmeter中设置HEAP为5G后,仍然可以正常启动?

enter image description here

最佳答案

根据 Java Performance Tuning, Profiling, and Memory Management文章

  • Unless you have problems with pauses, try granting as much memory as possible to the virtual machine

  • Setting -Xms and -Xmx to the same value ….but be sure about the application behaviour

  • Be sure to increase the memory as you increase the number of processors, since allocation can be parallelized

  • Don’t forget to tune the Perm generation

根据 Make Sense of Memory Management and Key Memory Measurements

  • Cached memory holds data or program code that has been fetched into memory during the current session but is no longer in use now. If necessary, the Windows memory manager will flush the contents of cached memory to make room for newly summoned data.

  • Free memory represents RAM that does not contain any data or program code and is free for use immediately.

  • Commit Charge (also called commit size) is the total amount of virtual memory that a program has touched (committed) in the current session, including memory that has been paged out of physical memory to the disk-backed page file. The Memory and Physical Memory counters on Task Manager’s Performance tab represent the sum of this value for all processes and the kernel. The Commit Charge Limit is the total amount of physical RAM and page file available—in other words, the maximum virtual memory.

因此,您的系统可以拥有比您在可用内存中看到的更多的内存,因为它可以从缓存和虚拟池中分配额外的页面,因此向 JMeter 提供 5 GB 的空间应该可以。

但是,您需要密切关注 JVM 堆使用情况和垃圾收集 Activity (这可以使用 JVisualVM 来完成),就好像您设置的堆太高,而 JMeter 不会真正使用该堆,JVM 会花费太多进行垃圾收集时需要更多时间,并且如果页面文件大量使用,您的 JMeter 引擎将无法正常运行,因为磁盘 IO 比 RAM 操作慢得多。

参见9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure文章了解有关调整 JMeter 以实现高负载的更多信息。

关于java - jmeter中的堆设置程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52107481/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com