I use jetty 9 and two DigitalOcean droplets with 1GB and 512mb memory. I set JAVA_OPTIONS -Xms128m -Xmx450m for both jetty instance, but my simple application use only 200mb heap and 50mb PermGen. On droplets with 512mb I observe what jetty shutdown without any exceptions per 1-2 hour! What a problem?
UPDATE hs_err_pid file
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
Jetty didn't fail, the Java VM did. With an OutOfMemory error.
You have a pretty small machine/os/vm there.
Only 500MB of total system memory, and no swap.
Setting the JVM to 1GB isn't going to work, as that exceeds your total system memory. Setting the JVM to 500MB isn't going to work, as that would exceed your available system memory. (keep in mind that your OS and other applications on that machine will use some memory as well)
You'll want to either add more memory to the machine, or analyze what the available system memory is without Jetty running and set a maximum memory that would fit into that space.