使用Jmeter对一个接口做压力测试,线程数为100,循环次数为100,运行一段时间后就出现卡死的现象,样本数不再增加。
查询百度后说需要修改jmeter.bat文件里面的堆值大小,最大值不能超过本机内存大小的50%,本机内存大小为16384MB,所以我把-XX:MaxMetaspaceSize的值修改为8100m,保存后重新启动jmeter,再执行压力测试仍然会出现卡死的现象。
原堆值为:
if not defined HEAP (
rem See the unix startup file for the rationale of the following parameters,
rem including some tuning recommendations
set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m
)
set HEAP=-Xms512m -Xmx1024m -XX:MaxMetaspaceSize=256m
修改为:
if not defined HEAP (
rem See the unix startup file for the rationale of the following parameters,
rem including some tuning recommendations
set HEAP=-Xms4g -Xmx4g -XX:MaxMetaspaceSize=8100m
)
set HEAP=-Xms512m -Xmx1024m -XX:MaxMetaspaceSize=8100m