What would cause a java process to greatly exceed the Xmx or Xss limit?

11,428

Turns out this is a glibc problem.

The short answer for me was:

export MALLOC_ARENA_MAX=1

This decreased process footprint (VIRT in top) by as much as 5x. Back to the levels seen in CentOS 5.

Recent versions of glibc have a new feature "per-thread memory pools":

http://www.centos.org/docs/5/html/5.4/Technical_Notes/glibc.html

The last item in the 1.71.1 log section discusses it (and refers to a non-public bug....)

Share:
11,428

Related videos on Youtube

Wayne Walker
Author by

Wayne Walker

Updated on June 05, 2022

Comments

  • Wayne Walker
    Wayne Walker almost 2 years

    I have 7 different java daemons that I run (all 7) on 3 different servers. The java command line has -Xmx2048m and -Xss1024k. On these 3 servers, all 21 processes show just under 2.5 GB for VIRT size in top and atop. RES size varies from 300 to 1.9 GB according to which daemon it is.

    That is all as it should be.

    Enter the new server. Faster CPU, more RAM (16 GB instead of 8 GB), slightly newer java (1.6.0_10-b33 on the old servers, 1.6.0_31-b04 on the new server). Both systems (and JVMs) are 64bit.

    Moved 2 of the daemons to the new server. On the new server, given the same task, the daemons are both consuming vastly more CPU (about a core's worth) and getting Less done. (Moved from 5110 processors on the old systems to 5620s on the new one).

    Pretty much a full extra core of CPU usage (GC thread??) and reporting 5 GB VIRT and 2 GB RES for one daemon and 10.5 GB VIRT and 2 GB RES for the other daemon.

    Any ideas what would cause java to ignore (or appear to ignore if that is the case) the memory limits?

  • michael
    michael almost 10 years
    You might want to set MALLOC_ARENA_MAX to 4 instead of 1, to get some of the multi-threading memory benefits that the change was intended to address. See this: issues.apache.org/jira/browse/HADOOP-7154