简体   繁体   English

詹金斯 java.lang.OutOfMemoryError:超出 GC 开销限制

[英]Jenkins java.lang.OutOfMemoryError: GC overhead limit exceeded

I am currently working on creating a performance framework using jenkins and execute the performance test from Jenkins.我目前正在使用 jenkins 创建一个性能框架,并从 Jenkins 执行性能测试。 I am using https://github.com/jmeter-maven-plugin/jmeter-maven-plugin this plugin.我正在使用https://github.com/jmeter-maven-plugin/jmeter-maven-plugin这个插件。 The sanity test with single user in this performance framework worked well and went ahead with an actual performance test of 200 users and within 2 mins received the error java.lang.OutOfMemoryError: GC overhead limit exceeded I tried the following in jenkins.xml在这个性能框架中对单个用户的健全性测试运行良好,并进行了 200 个用户的实际性能测试,并在 2 分钟内收到错误 java.lang.OutOfMemoryError: GC 开销限制超出我在 jenkins.xml 中尝试了以下内容

<arguments>-Xrs -Xmx2048m -XX:MaxPermSize=512m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --prefix=/jenkins --webroot="%BASE%\war"</arguments>

but it didn't work and also noted that whenever I increased the memory the jenkins service stops and had to reduce the memory to 1Gb and then the service restarts.但它没有用,并且还指出,每当我增加内存时,jenkins 服务就会停止,不得不将内存减少到 1Gb,然后服务会重新启动。

Had increased the memory for jmeter and java as well but no help.也增加了 jmeter 和 java 的内存,但没有帮助。 In the .jmx file view results tree and every other listener is disabled but still the issue persists.在 .jmx 文件视图结果树中,所有其他侦听器都已禁用,但问题仍然存在。

Since I am doing a POC jenkins is hosted in my laptop and high level specs as follows System Model : Latitude E7270 Processor : Intel(R) Core(TM) i5-6300U CPU @ 2.40GHZ(4CPU's), ~2.5GHZ Memory : 8192MB RAM由于我正在做 POC,jenkins 托管在我的笔记本电脑中,高级规格如下系统型号:Latitude E7270 处理器:Intel(R) Core(TM) i5-6300U CPU @ 2.40GHZ(4CPU's),~2.5GHZ 内存:8192MB内存

Any help please ?请问有什么帮助吗?

The error about GC overhead implies that Jenkins is thrashing in Garbage Collection.关于 GC 开销的错误意味着 Jenkins 在垃圾收集中运行缓慢。 This means it's probably spending more time doing Garbage Collection than doing useful work.这意味着它可能花在垃圾收集上的时间比做有用的工作要多。

This situation normally comes about when the heap is too small for the application.当堆对于应用程序来说太小时,通常会出现这种情况。 With modern multi generational heap layouts it's difficult to say what exactly needs changing.对于现代多代堆布局,很难说到底需要改变什么。

I would suggest you enable Verbose GC with the following options "-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps"我建议您使用以下选项启用 Verbose GC“-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps”

Then follow the advice here: http://www.oracle.com/technetwork/articles/javase/gcportal-136937.html然后按照这里的建议: http : //www.oracle.com/technetwork/articles/javase/gcportal-136937.html

Few points to note需要注意的几点

  1. You are using the integrated maven goal to run your jmeter tests.您正在使用集成的 maven 目标来运行 jmeter 测试。 This will use Jenkins as the container to launch your jmeter tests thereby not only impacting your work but also other users of jenkins这将使用 Jenkins 作为容器来启动您的 jmeter 测试,从而不仅会影响您的工作,还会影响 jenkins 的其他用户
  2. It is better to defer the execution to a different client machine like a dedicated jmeter machine which uses its own JVM with parameters to launch your tests (OR) use the one that you provide最好将执行推迟到不同的客户端机器上,例如专用的 jmeter 机器,它使用自己的 JVM 和参数来启动您的测试(或)使用您提供的测试

In summary, 1. Move the test execution out of jenkins 2. Provide the output of the report as an input to your performance plug-in [ this can also crash since it will need more JVM memory when you process endurance test results like an 8 hour result file]总之,1. 将测试执行移出 jenkins 2. 提供报告的输出作为性能插件的输入 [这也可能崩溃,因为当您处理像 8小时结果文件]

This way, your tests will have better chance of scaling.这样,您的测试将有更好的扩展机会。 Also, you haven't mentioned what type of scripting engine that you are using.此外,您还没有提到您使用的是哪种类型的脚本引擎。 AS per Jmeter documentation, JSR223 with groovy has a memory leak.根据 Jmeter 文档,带有 groovy 的 JSR223 存在内存泄漏。 Please refer http://jmeter.apache.org/usermanual/component_reference.html#JSR223_Sampler请参考http://jmeter.apache.org/usermanual/component_reference.html#JSR223_Sampler

Try adding -Dgroovy.use.classvalue=true to see if that helps (provided you are using groovy).尝试添加 -Dgroovy.use.classvalue=true 以查看是否有帮助(前提是您使用的是 groovy)。 If you are using Java 8, there is a high chance that it is creating unique class for all your scripts in jmeter and it is increasing the meta space which is outside your JVM.如果您使用的是 Java 8,它很有可能在 jmeter 中为您的所有脚本创建唯一的类,并且它正在增加 JVM 之外的元空间。 In that case, restrict the meta space and use class unloading and a 64 bit JVM like在这种情况下,限制元空间并使用类卸载和 64 位 JVM,例如

-d64 -XX:+CMSClassUnloadingEnabled. -d64 -XX:+CMSClassUnloadingEnabled。

Also, what is your new generation size.另外,你的新一代尺寸是多少。 -XX:NewSize=1024m -XX:MaxNewSize=1024m ? -XX:NewSize=1024m -XX:MaxNewSize=1024m ? Please note jmeter loads all the files permanently and it will go directly to the old generation thereby shrinking any available space for new generation.请注意 jmeter 永久加载所有文件,它将直接进入老一代,从而缩小新一代的可用空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Java PreparedStatement java.lang.OutOfMemoryError:超出了GC开销限制 - Java PreparedStatement java.lang.OutOfMemoryError: GC overhead limit exceeded java.lang.OutOfMemoryError:GC开销限制超出了android studio - java.lang.OutOfMemoryError: GC overhead limit exceeded android studio Gridgain:java.lang.OutOfMemoryError:超出了GC开销限制 - Gridgain: java.lang.OutOfMemoryError: GC overhead limit exceeded Spark失败了java.lang.OutOfMemoryError:超出了GC开销限制? - Spark fails with java.lang.OutOfMemoryError: GC overhead limit exceeded? SonarQube java.lang.OutOfMemoryError:超出了GC开销限制 - SonarQube java.lang.OutOfMemoryError: GC overhead limit exceeded Tomcat java.lang.OutOfMemoryError:超出了GC开销限制 - Tomcat java.lang.OutOfMemoryError: GC overhead limit exceeded java.lang.OutOfMemoryError:超出 GC 开销限制 - java.lang.OutOfMemoryError: GC overhead limit exceeded 超出Junit java.lang.OutOfMemoryError GC开销限制 - Junit java.lang.OutOfMemoryError GC overhead limit exceeded 获取错误:java.lang.OutOfMemoryError:超出了GC开销限制 - Getting Error:java.lang.OutOfMemoryError: GC overhead limit exceeded 获取java.lang.OutOfMemoryError:Jboss中超出了GC开销限制 - Getting java.lang.OutOfMemoryError: GC overhead limit exceeded in Jboss
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM