我使用jetty 9和两个带有1GB和512mb内存的DigitalOcean水滴。 我为两个jetty实例设置了JAVA_OPTIONS -Xms128m -Xmx450m,但是我的简单应用程序只使用200mb堆和50mb PermGen。 在512mb的液滴上,我会观察每1-2小时没有任何异常的码头停机! 怎么了?
更新hs_err_pid文件
There is insufficient memory for the Java Runtime Environment to continue.
Native memory allocation (malloc) failed to allocate 26652672 bytes for committing reserved memory.
Possible reasons:
The system is out of physical RAM or swap space
In 32 bit mode, the process size limit was hit
Possible solutions:
Reduce memory load on the system
Increase physical memory or swap space
Check if swap backing store is full
Use 64 bit Java on a 64 bit OS
Decrease Java heap size (-Xmx/-Xms)
Decrease number of Java threads
Decrease Java thread stack sizes (-Xss)
Set larger code cache with -XX:ReservedCodeCacheSize=
This output file may be truncated or incomplete.
# Out of Memory Error (os_linux.cpp:2745), pid=1725, tid=140114409527040
#
# JRE version: Java(TM) SE Runtime Environment (7.0_71-b14) (build 1.7.0_71-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.71-b01 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
--------------- S Y S T E M ---------------
OS:jessie/sid
uname:Linux 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64
libc:glibc 2.19 NPTL 2.19
rlimit: STACK 8192k, CORE 0k, NPROC 3750, NOFILE 4096, AS infinity
load average:1.35 0.41 0.23
/proc/meminfo:
MemTotal: 501808 kB
MemFree: 4744 kB
Buffers: 352 kB
Cached: 10752 kB
SwapCached: 0 kB
Active: 457108 kB
Inactive: 6000 kB
Active(anon): 452136 kB
Inactive(anon): 268 kB
Active(file): 4972 kB
Inactive(file): 5732 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 72 kB
Writeback: 0 kB
AnonPages: 452036 kB
Mapped: 6436 kB
Shmem: 352 kB
Slab: 17244 kB
SReclaimable: 8520 kB
SUnreclaim: 8724 kB
KernelStack: 1304 kB
PageTables: 4696 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 250904 kB
Committed_AS: 651712 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 7852 kB
VmallocChunk: 34359723260 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 65528 kB
DirectMap2M: 458752 kB
DirectMap1G: 0 kB
CPU:total 1 (1 cores per cpu, 1 threads per core) family 6 model 45 stepping 7, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, aes, tsc
/proc/cpuinfo:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2630L 0 @ 2.00GHz
stepping : 7
microcode : 0x1
cpu MHz : 1999.999
cache size : 15360 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx hypervisor lahf_lm xsaveopt vnmi ept tsc_adjust
bogomips : 3999.99
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
Memory: 4k page, physical 501808k(4744k free), swap 0k(0k free)
vm_info: Java HotSpot(TM) 64-Bit Server VM (24.71-b01) for linux-amd64 JRE (1.7.0_71-b14), built on Sep 26 2014 16:41:40 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8)
time: Sat Dec 20 21:15:31 2014
elapsed time: 42 seconds
答案 0 :(得分:1)
你有一台非常小的机器/ os / vm 只有500MB的系统总内存,而且没有交换。
将JVM设置为1GB无法正常工作,因为它超出了系统总内存。 将JVM设置为500MB并不起作用,因为这会超出可用的系统内存。 (请记住,您的操作系统和该计算机上的其他应用程序也将使用一些内存)
您希望为计算机添加更多内存,或者分析没有Jetty运行的可用系统内存,并设置适合该空间的最大内存。