java - 堆大小迅速增加弹簧启动应用程序
问题描述
我在spring boot上有应用程序,使用mongoDB和hibernate for MySQL。应用程序的堆大小在生产中不断增加。我提供的最大堆大小为 24 GB,这已经很大了。现在使用的堆达到 23 GB。对如此巨大的内存进行堆转储是否很好,它会影响性能,因为它是实时应用程序。
另一种检测内存泄漏的方法?或者其他分析休眠或mongo指标的方法?
解决方案
Try to see the heap memory in jprofiler or jvisualvm. One of the options could be that heap would take all the memory you provide, but use only some part of it. In general it would depend of Garbage Collector algorithm. I would recommend you to perform following steps:
1) Check if the memory taken by heap is actually used (you can see it in jprofiler or jvisualvm). If the application is taking all memory but doesn't use it you can restrict it with some reasonable value using Xmx jvm argument.
2) See the memory usage under the load and idle. See the difference. Depending on the operations you do there might be some objects sitting in memory, but they should be collected time-to time.
3) If it is really leak and you see the memory reserved by jvm is really used and never released - take a memory dump and see what kind of objects are sitting there (again try jprofiler or jvisualvm). This will give you a clue where to look.
推荐阅读
- java - 如何使用 Guava MultiMap 存储针对相同键的重复值并检索键和值
- gradle - testTags() 测试方法在我的 gradle 项目中未被识别为测试,使用 junit5
- amazon-s3 - 如何从 1Mbps 加速 S3 signedUrl 上传
- ruby-on-rails - 不均匀数据上的一致解析浮点值
- flutter - 您应该在 setState 内的列表上调用 clear() 还是将列表设置为空数组?
- java - Spring Boot 应用程序中的 Hazelcast 客户端测试
- javascript - 如何计算在 javascript 中使用事件侦听器点击的 div
- python - 为什么我从 tensorflow 网站收到此代码的语法错误?
- html - 如何使用javascript更改href文本我被卡住了
- azure-active-directory - Azure B2C - 重命名输出声明