简体   繁体   English

cpu使用率高会影响JAVA GC吗?

[英]Does high cpu usage affect JAVA GC?

Recently I am developing an android app for video conferencing.最近我正在开发一个用于视频会议的 android 应用程序。 I observed that when the cpu usage is less than 95%, there is half free memory left.我观察到当 cpu 使用率低于 95% 时,还剩下一半空闲内存。 However when the cpu usage goes up, the memory usage will soon reach 90% and even more.但是当cpu使用率上升时,内存使用率很快就会达到90%甚至更多。 I don`t have much knowledge with JVM or GC and I was wondering is the GC performance somehow related two the cpu usage?我对 JVM 或 GC 不太了解,我想知道 GC 性能是否与 CPU 使用率有关?

If it is, is there a advice that I can follow to balance cpu and memory usage?如果是,是否有我可以遵循的建议来平衡 cpu 和内存使用情况?

Thank you in advance.先感谢您。

I suspect that the causal relationship is the other way around.我怀疑因果关系是相反的。

  • Your heap is getting too full.你的堆太满了。
  • That is causing the GC to run frequently.这导致 GC 频繁运行。
  • That is causing the CPU usage to peak.这导致 CPU 使用率达到峰值。

If this is the problem, you should be looking for what is causing your heap to get too full;如果这是问题所在,您应该寻找导致堆太满的原因; eg look for memory leaks.例如寻找内存泄漏。

http://www.dynatrace.com/en/javabook/impact-of-garbage-collection-on-performance.html http://www.dynatrace.com/en/javabook/impact-of-garbage-collection-on-performance.html

That link should explain how gc works.该链接应该解释 gc 是如何工作的。 In general high memory means you have too many objects open and garbage collection cannot close them.一般来说,高内存意味着您打开了太多对象,垃圾收集无法关闭它们。 Not the other way around.不是反过来。

Based on the stats you have provided it looks like as your app does more processing it needs more memory not allowing information to be removed.根据您提供的统计数据,当您的应用程序进行更多处理时,它需要更多内存,不允许删除信息。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM