如何在Spring MVC中获取每个用户会话的JVM堆大小,已用内存,总内存?

时间:2022-02-14 16:38:37

We are trying to analyze memory consumption for each user session in spring MVC application on Tomcat server.

我们正在尝试分析Tomcat服务器上的spring MVC应用程序中每个用户会话的内存消耗。

1 个解决方案

#1


0  

You can't, directly at least. The heap isn't partitioned per user session and so the GC logs etc. will be for the JVM as a whole.

你不能,至少直接。堆不是按用户会话分区的,因此GC日志等将作为整个JVM。

What you can do is use a heap dump and then something like Eclipse MAT to analyse the dump afterwards and calculate the total retained size for each of the session objects.

您可以做的是使用堆转储,然后使用Eclipse MAT之类的东西来分析转储,并计算每个会话对象的总保留大小。

#1


0  

You can't, directly at least. The heap isn't partitioned per user session and so the GC logs etc. will be for the JVM as a whole.

你不能,至少直接。堆不是按用户会话分区的,因此GC日志等将作为整个JVM。

What you can do is use a heap dump and then something like Eclipse MAT to analyse the dump afterwards and calculate the total retained size for each of the session objects.

您可以做的是使用堆转储,然后使用Eclipse MAT之类的东西来分析转储,并计算每个会话对象的总保留大小。