tags:

views:

150

answers:

1

I am trying to allocate ram with xms = xmx on a sles10 x64 running under VMware.

When stopping the JVM the following error is thrown:

Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 12).

The RAM of the VM is 8 GB and they are reserved.

The VM sees 8GB and it can be allocated during runtime via the XMX setting.

On another Virtual SLES10 with 16 GB RAM Reserved via VMWare I don't have a problem with allocation of RAM even when setting the hugepages and shmax only by echo it works fine.

echo 8000 > /proc/sys/vm/nr_hugepages

echo 8589934592 > /proc/sys/kernel/shmmax

Using the echo commands on the other SLES10 show no effect in /proc/meminfo at all.

here are my configs 1st on is the SLES10 where XMS fails to allocate.

 # more /apps/liferay-portal-5.2.5/tomcat-5.5.27/bin/setenv.sh
JAVA_HOME=/apps/java5
JRE_HOME=/apps/java5
JAVA_OPTS="$JAVA_OPTS -Xms3G -Xmx3G -XX:NewRatio=3 -XX:MaxPermSize=256m -XX:SurvivorRatio=20 -Dsun.rmi.dgc.client.gcInterval=1800000 -Dsun.rmi.dgc.server.gcInterval=1800000 -XX:+UsePa
rallelGC -XX:ParallelGCThreads=4 -XX:+UseLargePages -Xloggc:/apps/gc.log -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGC -XX:+PrintGCTimeStamps -
XX:+PrintGCDetails -Dfile.encoding=UTF8 -Duser.timezone=GMT+2 -Djava.security.auth.login.config=$CATALINA_HOME/conf/jaas.config -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_C
LEAR_REFERENCES=false"


more /etc/sysctl.conf
kernel.shmmax=7516192768
vm.nr_hugepages=3072
vm.hugetlb_shm_group=1000

more /etc/securtiy/limits.conf

#                 
#

#*               soft    core            0
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#@student        -       maxlogins       4
*                soft    memlock         unlimited
*                hard    memlock         unlimited
tomcat           soft    memlock         6291456
tomcat           hard    memlock         6291456
# End of file


 # cat /proc/meminfo
MemTotal:      7928752 kB
MemFree:        737004 kB
Buffers:             0 kB
Cached:         417368 kB
SwapCached:          0 kB
Active:         487428 kB
Inactive:       324072 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:      7928752 kB
LowFree:        737004 kB
SwapTotal:     2097144 kB
SwapFree:      2097020 kB
Dirty:               0 kB
Writeback:           0 kB
AnonPages:      397208 kB
Mapped:          72180 kB
Slab:            62136 kB
CommitLimit:   2915792 kB
Committed_AS:   748576 kB
PageTables:       3292 kB
VmallocTotal: 34359738367 kB
VmallocUsed:      7028 kB
VmallocChunk: 34359731271 kB
HugePages_Total:  3072
HugePages_Free:   2305
HugePages_Rsvd:    897
Hugepagesize:     2048 kB

# ipcs -l

Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 7340032
max total shared memory (kbytes) = 4611686018427386880
min seg size (bytes) = 1

Semaphore Limits --------
max number of arrays = 1024
max semaphores per array = 250
max semaphores system wide = 256000
max ops per semop call = 32
semaphore max value = 32767

Messages: Limits --------
max queues system wide = 16
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536

# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
pending signals                 (-i) 65536
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 65536
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

On the Second VM it looks like this

cat /proc/meminfo
MemTotal:     16190448 kB
MemFree:        176812 kB
Buffers:         52752 kB
Cached:         755256 kB
SwapCached:          0 kB
Active:         713808 kB
Inactive:       425300 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:     16190448 kB
LowFree:        176812 kB
SwapTotal:    35658896 kB
SwapFree:     35658796 kB
Dirty:             932 kB
Writeback:           0 kB
AnonPages:      333620 kB
Mapped:          79120 kB
Slab:            37492 kB
CommitLimit:  36356744 kB
Committed_AS:   646284 kB
PageTables:       3584 kB
VmallocTotal: 34359738367 kB
VmallocUsed:     23500 kB
VmallocChunk: 34359713907 kB
HugePages_Total:  7224
HugePages_Free:   6654
HugePages_Rsvd:    582
Hugepagesize:     2048 kB

JAVA_OPTS="$JAVA_OPTS -Xms2G -Xmx2G -XX:NewRatio=3 -XX:MaxPermSize=256m -XX:SurvivorRatio=20 -Dsun.rmi.dgc.client.gcInterval=1800000 -Dsun.rmi.dgc.server.gcI
nterval=1800000 -XX:+UseParallelGC -XX:ParallelGCThreads=2 -XX:+UseLargePages -Xloggc:/apps/gc.log -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplication
ConcurrentTime -XX:+PrintGC -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Dfile.encoding=UTF8 -Duser.timezone=GMT+2 -Djava.security.auth.login.config=$CATALINA
_HOME/conf/jaas.config -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false"

hepide01pep1:~ # ipcs -l

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 8388608
max total shared memory (kbytes) = 4611686018427386880
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 1024
max semaphores per array = 250
max semaphores system wide = 256000
max ops per semop call = 32
semaphore max value = 32767

------ Messages: Limits --------
max queues system wide = 16
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536


A: 

Did you tried with the less size of heap.. may be with 2gig. You can just do simple try with java -Xmx3G -version .Let us know how it goes and what it spit out.

Anil Vishnoi
In first machine you are trying to allocate total 3g+256M= 3.25gig,but in second you are allocating 2g+256m=2.25m.So better test both machine with same heap size.But anyways 2.25 or 3.25,both should work with 64bit JDK.Can you let me know the JDK version are you using.
Anil Vishnoi
Meanwhile i did some Tests and finaly could allocate 2900m but Not 3gb After Setting the hugepages to 3200. On the other Host i did reduce the hugepages to 3200 from 8000 and now only could allocate 2900m . Restoring the pages back to 8000 i now can allocate 4gb again . I will check later which Version and try again with shorter Command line
macbert
java.runtime.name Java(TM) 2 Runtime Environment, Standard Editionjava.runtime.version 1.5.0_22-b03java.specification.name Java Platform API Specificationjava.specification.vendor Sun Microsystems Inc.java.specification.version 1.5
macbert
I did another test with JAVA_HOME=/apps/java5JRE_HOME=/apps/java5JAVA_OPTS="$JAVA_OPTS -Xms4G -Xmx4G -XX:MaxPermSize=256m -XX:+UseLargePages -Dfile.encoding=UTF8 -Duser.timezone=GMT+2 -Djava.security.auth.login.config=$CATALINA_HOME/conf/jaas.config -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false"and 3200 pages - still the same problem.
macbert
Did another test with java6 - same problemhepide01pep1:/apps/liferay-portal-5.2.5/tomcat-5.5.27/bin # ./shutdown.shUsing CATALINA_BASE: /apps/liferay-portal-5.2.5/tomcat-5.5.27Using CATALINA_HOME: /apps/liferay-portal-5.2.5/tomcat-5.5.27Using CATALINA_TMPDIR: /apps/liferay-portal-5.2.5/tomcat-5.5.27/tempUsing JRE_HOME: /apps/java6Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 12).
macbert
When don't using the -XX:+UseLargePages the error does not occur but this I guess isn't good for performance
macbert