简体   繁体   English

Linux中的本机内存使用似乎比通过JVM本身(例如,通过JConsole)观察到的要高得多

[英]Native memory usage in Linux seems to be much higher than observed through JVM itself (e.g. through JConsole)

We have a customer that uses WebSphere 7.0 on RedHat Linux Server 5.6 (Tikanga) with IBM JVM 1.6. 我们有一个客户在IBM JVM 1.6的RedHat Linux Server 5.6(Tikanga)上使用WebSphere 7.0。 When we look at the OS reports for memory usage, we see very high numbers and OS starts to use SWAP memory in some point due to lack in memory. 当我们查看操作系统报告中的内存使用情况时,我们看到数量非常高,并且由于内存不足,操作系统在某些时候开始使用SWAP内存。 On the other hand, JConsole graphs show perfectly normal behavior of memory - Heap size increases until GC is invoked when expected and Heap size drops to ~30% in normal cycles. 另一方面,JConsole图完美地显示了内存的正常行为-堆大小增加,直到在预期的时候调用GC为止,并且在正常周期中堆大小下降到〜30%。 Non heap is as expected and very constant in size. 非堆是预期的,并且大小非常恒定。

Does anyone have an idea what this extra native memory usage can be attributed to? 有谁知道这个额外的本机内存使用量可以归因于什么?

I would check you are looking at resident memory and not virtual memory (the later can be very high) 我会检查您正在查看驻留内存,而不是虚拟内存(后者可能很高)

If you swap, even slightly this can cause the JVM to halt for very long periods of time on a GC. 如果交换,即使稍微交换,这也可能导致JVM在GC上停顿很长时间。 If your application is not locking up for second or minutes, it probably isn't swapping (another program could be) 如果您的应用程序没有锁定第二或几分钟,则可能是没有交换(可能是另一个程序)

If your program really is using native memory, this will most like be due to a native library you have imported. 如果您的程序确实在使用本机内存,则最可能是由于您导入了本机库。 If you have a look at /proc/{id}/mmap this may give you a clue, but more likely to will have to check which native libraries you are loading. 如果您查看/ proc / {id} / mmap,这可能会给您一个线索,但更有可能必须检查您正在加载的本机库。


Note: if you have lots of threads, the stack space for all these reads can add up. 注意:如果您有很多线程,则所有这些读取的堆栈空间可能会累加。 I would try to keep these to a minimum if you can, but I have seen JVMs with many thousands and this can chew up native memory. 如果可以的话,我会尽量减少这些,但是我看到JVM有成千上万个,这会占用本机内存。 GUI components can also use native memory but I assume you don't have any of those. GUI组件也可以使用本机内存,但我假设您没有任何这些。

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

相关问题 JConsole堆转储比内存使用量小得多 - JConsole heap dump much smaller than memory usage 尝试通过JConsole连接到远程JVM - Trying to connect to a remote JVM through JConsole 如何在Java中映射(mmap)linux块设备(例如/ dev / sdb)? - How to memory map (mmap) a linux block device (e.g. /dev/sdb) in Java? 使用内存数据库(例如SQLite)是否比将所有内容保留在HashMap或其他数据结构中更好? - Is it better to use an in-memory database (e.g. SQLite) than to keep everything in HashMap or other data structures? 阵列可以比物理内存大吗? (例如可以部分分页) - Can an array be larger than physical memory? (e.g. can it be partially paged) 存储二进制路径的最有效方式(例如通过二叉树) - Most efficient way of storing a binary path (e.g. through a binary tree) 正则表达式似乎不支持特殊字符(例如+-。,!@#$%^&*;) - regex seems to be off for special characters (e.g. +-.,!@#$%^&*;) 在Java Servlet中使用静态变量(例如在AppEngine中) - Usage of Static variables in Java Servlets (e.g. in AppEngine) 使用该类是否更有效,例如Hashtable而不是接口,例如Map? - Is it more efficient to use the class, e.g. Hashtable than the interface, e.g. Map? 本机 memory 消耗的 JVM vs java 进程总 ZCD69B4957F06CD818D7BF3DD618 - Native memory consumed by JVM vs java process total memory usage
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM