1

This is on Centos 5, Linux 2.6.33.3-xenU #1 SMP Wed May 5 00:49:22 UTC 2010 i686 i686 i386 GNU/Linux

I have a java server process which I normally run with the following configuration

-Xmx700m -Xms500m -XX:PermSize=128m -noclassgc

And it runs like a champ. But over time, as my application data grows, that won't be enough for normal operations.

Recently, I added more memory to my VPS, and I tried to extend the memory:

-Xmx1024m -Xms1024m -XX:PermSize=256m -noclassgc

And what happens is that as it boots the application, it eats up all the "low memory" and my application crashes (and there's often a stack trace message from the kernel, but not a panic or bug)

And at that point, I'm toast - the defunct process seems to own all the low memory, and oom-killer starts killing everything. I have to reboot to fix it.

But when I go back to 700 meg, it runs like a champ again, and doesn't use much "low memory" at all - (i mean, there's about 690 meg of low memory allocated, and only about 140 meg is used)

[]$ free -lm
             total       used       free     shared    buffers     cached
Mem:          2700       1334       1365          0        100        274
Low:           689        140        548
High:         2011       1194        816
-/+ buffers/cache:        959       1740
Swap:          714          0        714

Java is 1.6:

java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)

Does anyone know why this is happening? I'm planning on upgrading java, but if there's another known issue for this scenario, I'd love to hear it. Changing out the kernel may be problematic, but if there are any server-local configuration changes I could make to use high memory instead of low memory.

2
  • I don't know why your JVM does that, but would you consider changing to a 64 bit kernel? Most 32-bit (userland) Xen VMs can run just fine on a 64-bit kernel. On 64-bit systems all memory is low memory, as far as I can tell. Apr 22, 2011 at 21:55
  • Yeah, I may have to switch to a new VPS to fix this. Thanks.
    – johnbr
    May 4, 2011 at 19:15

2 Answers 2

1

I've had similar issues in the past, but that was with a OpenVZ VPS rather than Xen. Other than upgrading Java, you may also want to try alternative JVMs, such as Oracle JRockit or the IBM JDK, which do not necessarily allocate memory in the same way and which may just solve your issue.

1
  • I tried to install another JVM, the low memory got eaten up by the installer, and the installer never finishes. :( So I don't think it's Java
    – johnbr
    May 4, 2011 at 19:16
0

the low memory is used by kernel - you would have the following levels

  • 0-16MB - very low level routines used by kernel
  • 16MB - 768MB - heap for kernel
  • 768MB - MAX_MEM - used for processes.

Even though you set the Xmx1024m to 1024 - that does not mean that the jvm will not take more memory(1024 should the memory that has available for the application + the jvm himself) - to see the actual memory footprint use ps -elF or top.

one more thing to look into it is the fact that xen has a baloon driver which reports more memory then you actually have - that is because the host(not vps) will try to give a bit more memory to vps then actually is available - but if the host is busy will just not have memory and your process is killed ... check with your vps provider.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .