性能问答>jvm的heap+meta space加起来占用不多,但是进程实际的RSS占用多>
19回复
2年前

jvm的heap+meta space加起来占用不多,但是进程实际的RSS占用多



jvm的heap+meta space加起来占用不多,但是进程实际的RSS占用多
image.png

image.png

image.png

3989 阅读
请先登录,再评论

代码里面有没有通过Unsafe的方式申请直接内存?

2年前
回复 张仲华:

image.png

2年前回复
回复 XIA:

现在我也不确定是不是就是堆外内存溢出了 但是分析dump出来的heap文件并没有什么异常

2年前回复
回复 张仲华:

没有的

2年前回复

后面查出原因了吗

1年前

看你的截图,好像Java Heap、Class、Thread啥的都没有问题,如果你是jdk8以上可以试着开启笨神所说的NMT去trace一下,看看是不是Internal、Symbol之类的部分出了问题,比如Symbol中的string table及constant pool啥的。

2年前

可以把你的JVM 启动参数贴一下?我怀疑一种情况,若系统内存够用,JVM 的内存使用又没做限制,进程的 RSS 可能不会退还给 OS,但是,当 OS 的内存不够用,比如即将使用到 SWAP 的时候(如果有 swap 的话),进程的 RSS 就会被回收(当然,这是在不存在内存泄漏的情况下)。

2年前
回复 西湖の风:

你好,JVM参数原来有设置xms,xmx的。这个版本没有设置,所有的都使用的是默认的。
机器内存是32G的,同时有20个左右的java进程在运行。

原先没有设置的时候,增长速度比这个快很多
20200512 10:30:04 CPU used ratio: 19.86% MEM used ratio: 41.9%
20200512 10:31:04 CPU used ratio: 14.89% MEM used ratio: 46.9%
20200512 10:32:04 CPU used ratio: 9.22% MEM used ratio: 48.3%
20200512 10:33:04 CPU used ratio: 9.62% MEM used ratio: 48.9%
20200512 10:34:04 CPU used ratio: 8.36% MEM used ratio: 50.4%
20200512 10:35:04 CPU used ratio: 8.6% MEM used ratio: 51.3%
20200512 10:36:04 CPU used ratio: 7.36% MEM used ratio: 51.6%
20200512 10:37:04 CPU used ratio: 9.24% MEM used ratio: 52.5%
20200512 10:38:04 CPU used ratio: 8.58% MEM used ratio: 53.2%
20200512 10:39:04 CPU used ratio: 8.46% MEM used ratio: 54.1%
20200512 10:40:04 CPU used ratio: 7.46% MEM used ratio: 54.8%
20200512 10:41:04 CPU used ratio: 7.87% MEM used ratio: 55.4%
20200512 10:42:04 CPU used ratio: 7.19% MEM used ratio: 55.5%
20200512 10:43:04 CPU used ratio: 14.83% MEM used ratio: 56.6%
20200512 10:44:04 CPU used ratio: 13.22% MEM used ratio: 58.2%
20200512 10:45:04 CPU used ratio: 12.17% MEM used ratio: 59.6%
20200512 10:46:04 CPU used ratio: 12.73% MEM used ratio: 60.7%
20200512 10:47:05 CPU used ratio: 12.27% MEM used ratio: 61.5%
20200512 10:48:05 CPU used ratio: 12.5% MEM used ratio: 61.7%
20200512 10:49:04 CPU used ratio: 11.93% MEM used ratio: 61.4%
20200512 10:50:04 CPU used ratio: 11.78% MEM used ratio: 60.8%
20200512 10:51:04 CPU used ratio: 11.88% MEM used ratio: 60.3%
20200512 10:52:04 CPU used ratio: 12.64% MEM used ratio: 60.0%
20200512 10:53:04 CPU used ratio: 11.98% MEM used ratio: 59.9%
20200512 10:54:05 CPU used ratio: 12.67% MEM used ratio: 60.0%
20200512 10:55:04 CPU used ratio: 12.88% MEM used ratio: 60.1%
20200512 10:56:04 CPU used ratio: 12.83% MEM used ratio: 60.2%
20200512 10:57:04 CPU used ratio: 12.84% MEM used ratio: 60.3%
20200512 10:58:04 CPU used ratio: 11.67% MEM used ratio: 60.4

现在将xms,xmx设置为1024M 昨天晚上启动后仍然有较缓慢但似乎明显的增长趋势(系统压力1线程在跑)
20200514 00:00:04 CPU used ratio: 11.29% MEM used ratio: 39.6%
20200514 00:05:04 CPU used ratio: 6.86% MEM used ratio: 39.7%
20200514 00:10:04 CPU used ratio: 7.94% MEM used ratio: 39.8%
20200514 00:15:04 CPU used ratio: 6.97% MEM used ratio: 39.8%
20200514 00:20:04 CPU used ratio: 7.11% MEM used ratio: 39.9%
20200514 00:25:04 CPU used ratio: 6.63% MEM used ratio: 39.8%
20200514 00:30:05 CPU used ratio: 7.38% MEM used ratio: 39.9%
20200514 00:35:04 CPU used ratio: 6.36% MEM used ratio: 39.9%
20200514 00:40:04 CPU used ratio: 6.33% MEM used ratio: 39.9%
20200514 00:45:05 CPU used ratio: 6.36% MEM used ratio: 39.9%
20200514 00:50:04 CPU used ratio: 6.75% MEM used ratio: 39.9%
20200514 00:55:04 CPU used ratio: 6.55% MEM used ratio: 39.9%
20200514 01:00:04 CPU used ratio: 4.98% MEM used ratio: 39.9%
20200514 01:05:04 CPU used ratio: 6.69% MEM used ratio: 39.9%
20200514 01:10:04 CPU used ratio: 6.89% MEM used ratio: 39.9%
20200514 01:15:04 CPU used ratio: 6.15% MEM used ratio: 39.9%
20200514 01:20:04 CPU used ratio: 6.44% MEM used ratio: 39.9%
20200514 01:25:04 CPU used ratio: 5.55% MEM used ratio: 39.9%
20200514 01:30:04 CPU used ratio: 5.83% MEM used ratio: 39.9%
20200514 01:35:04 CPU used ratio: 5.99% MEM used ratio: 39.9%
20200514 01:40:04 CPU used ratio: 7.21% MEM used ratio: 40.0%
20200514 01:45:04 CPU used ratio: 5.83% MEM used ratio: 40.0%
20200514 01:50:04 CPU used ratio: 6.85% MEM used ratio: 40.0%
20200514 01:55:04 CPU used ratio: 6.53% MEM used ratio: 40.0%
20200514 02:00:04 CPU used ratio: 7.37% MEM used ratio: 40.0%
20200514 02:05:04 CPU used ratio: 5.9% MEM used ratio: 40.0%
20200514 02:10:04 CPU used ratio: 7.75% MEM used ratio: 40.0%
20200514 02:15:05 CPU used ratio: 6.77% MEM used ratio: 40.1%
20200514 02:20:04 CPU used ratio: 6.12% MEM used ratio: 40.1%
20200514 02:25:04 CPU used ratio: 5.39% MEM used ratio: 40.1%
20200514 02:30:04 CPU used ratio: 5.9% MEM used ratio: 40.1%
20200514 02:35:04 CPU used ratio: 6.99% MEM used ratio: 40.1%
20200514 02:40:04 CPU used ratio: 7.29% MEM used ratio: 40.1%
20200514 02:45:04 CPU used ratio: 6.96% MEM used ratio: 40.1%
20200514 02:50:04 CPU used ratio: 5.79% MEM used ratio: 40.1%
20200514 02:55:04 CPU used ratio: 6.88% MEM used ratio: 40.1%
20200514 03:00:04 CPU used ratio: 6.93% MEM used ratio: 40.1%
20200514 03:05:04 CPU used ratio: 5.86% MEM used ratio: 40.1%
20200514 03:10:04 CPU used ratio: 6.84% MEM used ratio: 40.1%
20200514 03:15:04 CPU used ratio: 6.94% MEM used ratio: 40.1%
20200514 03:20:05 CPU used ratio: 6.08% MEM used ratio: 40.1%
20200514 03:25:04 CPU used ratio: 6.2% MEM used ratio: 40.2%
20200514 03:30:04 CPU used ratio: 8.77% MEM used ratio: 40.2%
20200514 03:35:04 CPU used ratio: 6.45% MEM used ratio: 40.2%
20200514 03:40:04 CPU used ratio: 7.29% MEM used ratio: 40.2%
20200514 03:45:04 CPU used ratio: 5.79% MEM used ratio: 40.2%
20200514 03:50:04 CPU used ratio: 6.72% MEM used ratio: 40.2%
20200514 03:55:04 CPU used ratio: 7.76% MEM used ratio: 40.2%
20200514 04:00:04 CPU used ratio: 6.84% MEM used ratio: 40.2%
20200514 04:05:04 CPU used ratio: 6.19% MEM used ratio: 40.2%
20200514 04:10:04 CPU used ratio: 6.3% MEM used ratio: 40.2%
20200514 04:15:04 CPU used ratio: 7.22% MEM used ratio: 40.2%
20200514 04:20:04 CPU used ratio: 6.87% MEM used ratio: 40.2%
20200514 04:25:04 CPU used ratio: 6.28% MEM used ratio: 40.2%
20200514 04:30:05 CPU used ratio: 6.92% MEM used ratio: 40.2%
20200514 04:35:04 CPU used ratio: 6.85% MEM used ratio: 40.2%
20200514 04:40:04 CPU used ratio: 5.75% MEM used ratio: 40.3%
20200514 04:45:04 CPU used ratio: 6.31% MEM used ratio: 40.3%
20200514 04:50:04 CPU used ratio: 6.79% MEM used ratio: 40.3%
20200514 04:55:04 CPU used ratio: 6.18% MEM used ratio: 40.3%
20200514 05:00:04 CPU used ratio: 7.21% MEM used ratio: 40.3%
20200514 05:05:04 CPU used ratio: 6.78% MEM used ratio: 40.3%
20200514 05:10:04 CPU used ratio: 7.46% MEM used ratio: 40.3%
20200514 05:15:04 CPU used ratio: 5.54% MEM used ratio: 40.3%
20200514 05:20:04 CPU used ratio: 6.11% MEM used ratio: 40.3%
20200514 05:25:04 CPU used ratio: 6.31% MEM used ratio: 40.3%
20200514 05:30:05 CPU used ratio: 6.62% MEM used ratio: 40.3%
20200514 05:35:04 CPU used ratio: 7.29% MEM used ratio: 40.3%
20200514 05:40:04 CPU used ratio: 6.85% MEM used ratio: 40.3%
20200514 05:45:04 CPU used ratio: 7.67% MEM used ratio: 40.3%
20200514 05:50:04 CPU used ratio: 6.7% MEM used ratio: 40.3%
20200514 05:55:04 CPU used ratio: 8.08% MEM used ratio: 40.3%
20200514 06:00:05 CPU used ratio: 6.13% MEM used ratio: 40.3%
20200514 06:05:04 CPU used ratio: 5.55% MEM used ratio: 40.3%
20200514 06:10:04 CPU used ratio: 6.48% MEM used ratio: 40.3%
20200514 06:15:05 CPU used ratio: 6.76% MEM used ratio: 40.3%
20200514 06:20:05 CPU used ratio: 8.12% MEM used ratio: 40.3%
20200514 06:25:04 CPU used ratio: 6.5% MEM used ratio: 40.3%
20200514 06:30:04 CPU used ratio: 6.72% MEM used ratio: 40.3%
20200514 06:35:04 CPU used ratio: 7.04% MEM used ratio: 40.3%
20200514 06:40:04 CPU used ratio: 6.76% MEM used ratio: 40.3%
20200514 06:45:04 CPU used ratio: 7.01% MEM used ratio: 40.3%
20200514 06:50:04 CPU used ratio: 5.94% MEM used ratio: 40.3%
20200514 06:55:04 CPU used ratio: 6.94% MEM used ratio: 40.3%
20200514 07:00:04 CPU used ratio: 6.82% MEM used ratio: 40.3%
20200514 07:05:04 CPU used ratio: 6.26% MEM used ratio: 40.3%
20200514 07:10:04 CPU used ratio: 5.95% MEM used ratio: 40.3%
20200514 07:15:04 CPU used ratio: 6.15% MEM used ratio: 40.3%
20200514 07:20:04 CPU used ratio: 6.8% MEM used ratio: 40.3%
20200514 07:25:04 CPU used ratio: 7.19% MEM used ratio: 40.3%
20200514 07:30:04 CPU used ratio: 6.7% MEM used ratio: 40.3%
20200514 07:35:04 CPU used ratio: 5.98% MEM used ratio: 40.3%
20200514 07:40:05 CPU used ratio: 6.28% MEM used ratio: 40.3%
20200514 07:45:04 CPU used ratio: 5.87% MEM used ratio: 40.3%
20200514 07:50:05 CPU used ratio: 6.07% MEM used ratio: 40.4%
20200514 07:55:04 CPU used ratio: 5.98% MEM used ratio: 40.4%
20200514 08:00:04 CPU used ratio: 6.59% MEM used ratio: 40.4%
20200514 08:05:04 CPU used ratio: 6.86% MEM used ratio: 40.4%
20200514 08:10:04 CPU used ratio: 7.74% MEM used ratio: 40.4%
20200514 08:15:04 CPU used ratio: 6.05% MEM used ratio: 40.4%
20200514 08:20:04 CPU used ratio: 7.2% MEM used ratio: 40.4%
20200514 08:25:04 CPU used ratio: 5.53% MEM used ratio: 40.4%
20200514 08:30:04 CPU used ratio: 6.09% MEM used ratio: 40.4%
20200514 08:35:04 CPU used ratio: 6.92% MEM used ratio: 40.4%
20200514 08:40:04 CPU used ratio: 8.04% MEM used ratio: 40.4%
20200514 08:45:05 CPU used ratio: 7.06% MEM used ratio: 40.4%
20200514 08:50:04 CPU used ratio: 7.22% MEM used ratio: 40.4%
20200514 08:55:04 CPU used ratio: 6.63% MEM used ratio: 40.4%
20200514 09:00:04 CPU used ratio: 6.15% MEM used ratio: 40.4%
20200514 09:05:04 CPU used ratio: 6.49% MEM used ratio: 40.4%
20200514 09:10:04 CPU used ratio: 6.46% MEM used ratio: 40.4%
20200514 09:15:04 CPU used ratio: 6.5% MEM used ratio: 40.4%
20200514 09:20:04 CPU used ratio: 7.46% MEM used ratio: 40.4%
20200514 09:25:04 CPU used ratio: 5.48% MEM used ratio: 40.4%
20200514 09:30:04 CPU used ratio: 6.03% MEM used ratio: 40.5%
20200514 09:35:04 CPU used ratio: 6.56% MEM used ratio: 40.5%
20200514 09:40:04 CPU used ratio: 6.17% MEM used ratio: 40.5%
20200514 09:45:04 CPU used ratio: 6.19% MEM used ratio: 40.5%
20200514 09:50:04 CPU used ratio: 5.71% MEM used ratio: 40.5%
20200514 09:55:04 CPU used ratio: 7.1% MEM used ratio: 40.5%
20200514 10:00:04 CPU used ratio: 7% MEM used ratio: 40.5%
20200514 10:05:04 CPU used ratio: 6.54% MEM used ratio: 40.5%
20200514 10:10:04 CPU used ratio: 6.39% MEM used ratio: 40.5%
20200514 10:15:04 CPU used ratio: 7.14% MEM used ratio: 40.5%
20200514 10:20:04 CPU used ratio: 5.9% MEM used ratio: 40.5%
20200514 10:25:05 CPU used ratio: 6.42% MEM used ratio: 40.5%
20200514 10:30:05 CPU used ratio: 6.76% MEM used ratio: 40.5%
20200514 10:35:04 CPU used ratio: 6.79% MEM used ratio: 40.5%
20200514 10:40:04 CPU used ratio: 6.15% MEM used ratio: 40.5%
20200514 10:45:05 CPU used ratio: 6.18% MEM used ratio: 40.5%
20200514 10:50:04 CPU used ratio: 6.18% MEM used ratio: 40.5%
20200514 10:55:04 CPU used ratio: 7.23% MEM used ratio: 40.5%
20200514 11:00:04 CPU used ratio: 6.1% MEM used ratio: 40.5%
20200514 11:05:04 CPU used ratio: 6.8% MEM used ratio: 40.4%
20200514 11:10:05 CPU used ratio: 7.11% MEM used ratio: 40.4%
20200514 11:15:04 CPU used ratio: 7.62% MEM used ratio: 40.4%
20200514 11:20:04 CPU used ratio: 5.87% MEM used ratio: 40.4%
20200514 11:25:04 CPU used ratio: 6.15% MEM used ratio: 40.4%
20200514 11:30:05 CPU used ratio: 7.04% MEM used ratio: 40.4%
20200514 11:35:04 CPU used ratio: 6.91% MEM used ratio: 40.4%
20200514 11:40:04 CPU used ratio: 6.99% MEM used ratio: 40.5%
20200514 11:45:04 CPU used ratio: 6.17% MEM used ratio: 40.5%
20200514 11:50:04 CPU used ratio: 6.76% MEM used ratio: 40.5%
20200514 11:55:04 CPU used ratio: 6.61% MEM used ratio: 40.5%
20200514 12:00:04 CPU used ratio: 6.68% MEM used ratio: 40.5%
20200514 12:05:05 CPU used ratio: 7.61% MEM used ratio: 40.5%
20200514 12:10:04 CPU used ratio: 6.17% MEM used ratio: 40.5%
20200514 12:15:04 CPU used ratio: 6.29% MEM used ratio: 40.5%
20200514 12:20:04 CPU used ratio: 6.43% MEM used ratio: 40.5%
20200514 12:25:04 CPU used ratio: 6.4% MEM used ratio: 40.5%
20200514 12:30:04 CPU used ratio: 6.34% MEM used ratio: 40.5%
20200514 12:35:04 CPU used ratio: 6.96% MEM used ratio: 40.5%
20200514 12:40:04 CPU used ratio: 6.9% MEM used ratio: 40.5%
20200514 12:45:04 CPU used ratio: 6.84% MEM used ratio: 40.5%
20200514 12:50:04 CPU used ratio: 6.61% MEM used ratio: 40.5%
20200514 12:55:04 CPU used ratio: 6.74% MEM used ratio: 40.5%
20200514 13:00:05 CPU used ratio: 6.89% MEM used ratio: 40.5%
20200514 13:05:04 CPU used ratio: 6.05% MEM used ratio: 40.5%
20200514 13:10:04 CPU used ratio: 5.92% MEM used ratio: 40.5%
20200514 13:15:04 CPU used ratio: 6.37% MEM used ratio: 40.5%
20200514 13:20:04 CPU used ratio: 7.31% MEM used ratio: 40.5%
20200514 13:25:04 CPU used ratio: 6.5% MEM used ratio: 40.5%
20200514 13:30:04 CPU used ratio: 6.55% MEM used ratio: 40.5%
20200514 13:35:04 CPU used ratio: 6.05% MEM used ratio: 40.5%
20200514 13:40:04 CPU used ratio: 6.93% MEM used ratio: 40.5%
20200514 13:45:05 CPU used ratio: 6.3% MEM used ratio: 40.5%
20200514 13:50:04 CPU used ratio: 5.46% MEM used ratio: 40.5%
20200514 13:55:04 CPU used ratio: 6.72% MEM used ratio: 40.5%
20200514 14:00:04 CPU used ratio: 7.61% MEM used ratio: 40.5%
20200514 14:05:04 CPU used ratio: 6.78% MEM used ratio: 40.5%
20200514 14:10:04 CPU used ratio: 5.67% MEM used ratio: 40.5%
20200514 14:15:05 CPU used ratio: 7.04% MEM used ratio: 40.5%
20200514 14:20:04 CPU used ratio: 7.14% MEM used ratio: 40.5%
20200514 14:25:04 CPU used ratio: 6.37% MEM used ratio: 40.5%
20200514 14:30:04 CPU used ratio: 6.16% MEM used ratio: 40.5%
20200514 14:35:04 CPU used ratio: 7.24% MEM used ratio: 40.5%
20200514 14:40:04 CPU used ratio: 8.4% MEM used ratio: 40.5%
20200514 14:45:04 CPU used ratio: 6.77% MEM used ratio: 40.5%
20200514 14:50:04 CPU used ratio: 6.12% MEM used ratio: 40.5%
20200514 14:55:04 CPU used ratio: 6.16% MEM used ratio: 40.5%
20200514 15:00:04 CPU used ratio: 6.88% MEM used ratio: 40.5%
20200514 15:05:04 CPU used ratio: 6.25% MEM used ratio: 40.5%
20200514 15:10:04 CPU used ratio: 6.52% MEM used ratio: 40.5%
20200514 15:15:04 CPU used ratio: 7.23% MEM used ratio: 40.5%
20200514 15:20:04 CPU used ratio: 7.87% MEM used ratio: 40.5%
20200514 15:25:04 CPU used ratio: 5.96% MEM used ratio: 40.5%
20200514 15:30:04 CPU used ratio: 6.67% MEM used ratio: 40.5%
20200514 15:35:05 CPU used ratio: 7.21% MEM used ratio: 40.6%
20200514 15:40:04 CPU used ratio: 7.53% MEM used ratio: 40.5%
20200514 15:45:04 CPU used ratio: 7.07% MEM used ratio: 40.5%
20200514 15:50:04 CPU used ratio: 6.16% MEM used ratio: 40.5%
20200514 15:55:04 CPU used ratio: 6.82% MEM used ratio: 40.5%
20200514 16:00:04 CPU used ratio: 6.69% MEM used ratio: 40.5%
20200514 16:05:04 CPU used ratio: 7% MEM used ratio: 40.5%
20200514 16:10:04 CPU used ratio: 6.81% MEM used ratio: 40.6%
20200514 16:15:04 CPU used ratio: 6.18%

准备今天加50线程的并发跑下压力再观察几天看看

2年前回复

可以用NativeMemoryTracking参数跟踪看看,还可以使用gperftools来分析下,从jconsole来看DirectByteBuffer是没啥问题的

2年前
回复 XIA:

嗯,和DirectByteBuffer没有关系,可以按我上面提示的看看,一个参数和一个分析工具

2年前回复
回复 XIA:

大神有时间帮忙指点下思路,谢谢

2年前回复
回复 你假笨:

image.png 用XLand的堆外内存分析了一下,好像堆外内存是没有占用的。那内存哪里去了?
image.png

2年前回复
查看更多

可能是堆外内存占比比较多,可以内存Dump看看,传到Perfma的内存分析产品里看看

2年前
回复 XIA:

后面查出原因了吗

1年前回复
回复 XIA:

image.png

直接内存占用也没有,有点凌乱

2年前回复
回复 Balloon:

专家请帮忙看看,多谢~

2年前回复
查看更多