简体   繁体   English

64位操作系统上的32位Java:JVM的数量是否有限制?

[英]32-bit Java on 64-bit OS: is there a limit to number of JVMs?

I have a Solaris sparc (64-bit) server, which has 16 GB of memory. 我有一个Solaris sparc(64位)服务器,它有16 GB的内存。 There are a lot of small Java processes running on it, but today I got the "Could not reserve enough space for object heap" error when trying to launch a new one. 有许多小型Java进程在其上运行,但是今天我在尝试启动一个新进程时遇到了“无法为对象堆保留足够的空间”错误。 I was surprised, since there was still more than 4GB free on the server. 我很惊讶,因为服务器上还有超过4GB的空闲空间。 The new process was able to successfully launch after some of the other processes were shut down; 一些其他流程关闭后,新流程能够成功启动; the system had definitely hit a ceiling of some kind. 该系统肯定达到了某种程度的上限。

After searching the web for an explanation, I began to wonder if it was somehow related to the fact that I'm using the 32-bit JVM (none of the java processes on this server require very much memory). 在网上搜索解释之后,我开始怀疑它是否与我使用32位JVM这一事实有关(此服务器上没有任何java进程需要非常多的内存)。

I believe the default max memory pool is 64MB, and I was running close to 64 of these processes. 我相信默认的最大内存池是64MB,我正在运行接近64个进程。 So that would be 4GB all told ... right at the 32-bit limit. 所以这就是4GB全部告诉...在32位限制。 But I don't understand why or how any of these processes would be affected by the others. 但我不明白为什么或如何将这些过程中的任何一个受到其他过程的影响。 If I'm right, then in order to run more of these processes I'll either have to tune the max heap to be lower than the default, or else switch to using the 64-bit JVM (which may mean raising the max heap to be higher than the default for these processes). 如果我是对的,那么为了运行更多这些进程,我要么必须将最大堆调整为低于默认值,要么切换到使用64位JVM(这可能意味着提高最大堆)高于这些过程的默认值)。 I'm not opposed to either of these, but I don't want to waste time and it's still a shot in the dark right now. 我并不反对这些中的任何一个,但我不想浪费时间,现在它仍然是黑暗中的一个镜头。

Can anyone explain why it might work this way? 任何人都可以解释为什么它可能会这样工作? Or am I completely mistaken? 还是我完全弄错了?

If I am right about the explanation, then there is probably documentation on this: I'd very much like to find it. 如果我对这个解释是正确的,那么可能有关于此的文档:我非常想找到它。 (I'm running Sun's JDK 6 update 17 if that matters.) (如果重要的话,我正在运行Sun的JDK 6更新17。)

Edit : I was completely mistaken . 编辑我完全错了 The answers below confirmed my gut instinct that there's no reason why I shouldn't be able to run as many JVMs as I can hold. 下面的答案证实了我的直觉,我没有理由不能运行尽可能多的JVM。 A little while later I got an error on the same server trying to run a non-java process: "fork: not enough space". 不久之后,我在尝试运行非java进程的同一台服务器上遇到错误:“fork:没有足够的空间”。 So there's some other limit I'm encountering that is not java-specific. 所以我遇到的其他限制不是特定于java的。 I'll have to figure out what it is (no, it's not swap space). 我必须弄清楚它是什么(不,它不是交换空间)。 Over to serverfault I go, most likely. 我很有可能去服务器故障。

I believe the default max memory pool is 64MB, and I was running close to 64 of these processes. 我相信默认的最大内存池是64MB,我正在运行接近64个进程。 So that would be 4GB all told ... right at the 32-bit limit. 所以这就是4GB全部告诉...在32位限制。

No. The 32bit limit is per process (at least on a 64bit OS). 不是。每个进程的32位限制(至少在64位操作系统上)。 But the default maximum heap is not fixed at 64MB : 默认的最大堆不固定为64MB

initial heap size: Larger of 1/64th of the machine's physical memory on the machine or some reasonable minimum. 初始堆大小:机器上物理内存的1/64或者合理的最小值。

maximum heap size: Smaller of 1/4th of the physical memory or 1GB. 最大堆大小:物理内存的1/4或1GB的较小值。

Note: The boundaries and fractions given for the heap size are correct for J2SE 5.0. 注意:为堆大小指定的边界和分数对于J2SE 5.0是正确的。 They are likely to be different in subsequent releases as computers get more powerful. 随着计算机变得越来越强大,它们在后续版本中可能会有所不同。

I suspect the memory is fragmented. 我怀疑内存是碎片化的。 Check also Tools to view/solve Windows XP memory fragmentation for a confirmation that memory fragmentation can cause such errors. 可以查看工具以查看/解决Windows XP内存碎片 ,以确认内存碎片可能导致此类错误。

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

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