0

在此处输入图像描述

我使用 jetty 9 和两个具有 1GB 和 512mb 内存的 DigitalOcean 液滴。我为两个码头实例设置了 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
4

1 回答 1

1

Jetty 没有失败,Java VM 失败了。出现 OutOfMemory 错误。

你在那里有一台非常小的机器/os/vm。
只有 500MB 的总系统内存,并且没有交换。

将 JVM 设置为 1GB 是行不通的,因为这超出了您的总系统内存。将 JVM 设置为 500MB 是行不通的,因为这会超出您的可用系统内存。(请记住,您的操作系统和该机器上的其他应用程序也会使用一些内存)

您需要向机器添加更多内存,或者在没有运行 Jetty 的情况下分析可用的系统内存,并设置适合该空间的最大内存。

于 2014-12-22T17:00:57.157 回答