简体   繁体   English

监视持续集成中的Java堆使用情况

[英]Monitor Java heap usage in continous integration

I would like to spot bad trends in the memory consumption of my product. 我想发现产品内存消耗方面的不良趋势。 I have something in mind like: 我想到的是:

  1. Execute integration tests in CI environment with activ garbage collection logs 在CI环境中使用活动垃圾收集日志执行集成测试
  2. Postprocess GC logs after test to find peaks in heap usage (eg max heap after GC). 测试后对GC进行后处理日志,以查找堆使用量的峰值(例如 GC 之后的最大堆)。 I would maybe use some Groovy scripts for parsing and doing the statistics. 我可能会使用一些Groovy脚本来解析和统计数据。

Record these numbers over time to see if the long-term trend shows surprising changes that need detailled analysis. 随时间记录这些数字,以查看长期趋势是否显示出令人惊讶的变化,需要进行详细分析。

Has anyone done something like that before? 有人做过类似的事情吗? Is that a completely stupid idea? 那是一个完全愚蠢的主意吗? Is there any advanced tooling? 是否有任何高级工具?

Most likely you won't find anything useful from a normal CI test. 正常的CI测试很可能找不到有用的东西。 We are running production-like (well, reasonably) load tests and there gc activity for 24+ hours is quite useful. 我们正在进行类似生产的(合理的)负载测试,并且24个小时以上的gc活动非常有用。 Some things are visible only after a week or more. 有些事情只有一周或更长时间才可见。 You may find some trends in just a few hours, but a typical CI test is probably too short. 您可能会在几个小时内发现一些趋势,但是典型的CI测试可能太短了。

If you want to go that route you can of course use the gc logs, but it is much easier to get the data from the JVM, either using Jolokia/JMX or with the jstat tool. 如果您想走这条路线,当然可以使用gc日志,但是使用Jolokia / JMX或使用jstat工具从JVM获取数据要容易得多。 Send it to InfluxDB/Graphite/other and graph it with Grafana or something. 将其发送到InfluxDB / Graphite / other并使用Grafana或其他图形进行绘制。 Being able to compare gc graphs for different periods and correlated with other events reported by the application is great! 能够比较不同时期的gc图并与应用程序报告的其他事件相关联,这真是太好了!

Try this answer . 试试这个答案

There suggest using spf4j . 有建议使用spf4j

I would like to something like launch of microservice to make sure it is able to start with provided memory limits + very fast smoke test. 我想要启动微服务之类的东西,以确保它能够以提供的内存限制+非常快速的冒烟测试开始。

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

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