Background:
We have a vendor-supplied Java application that has a slightly large bunch of Java. Without going into too much information, the application is a black box for us, but we feel that we need to take on the task to try to set up the work and fix the problems.
The 64-bit SunOS 10 machine has 16 GB of RAM, and the only non-system application that runs is the JVM for this application. The 64-bit JVM runs in JBoss, which, in my opinion, is not relevant to this discussion, and the maximum heap size is 8 GB, which in my opinion matters.
Recently, the problem is that we get various errors in memory. The heap is not full when these errors occur, and the error asks βOutside the swap space?β. The provider wants us to simply increase the swap from 2 GB to 4 GB. It is on a system with 16 GB, and the application is only 8 GB. We think this would be a bad idea for performance.
My question is:
So, we found that file caching uses all the remaining free memory to improve performance. This is usually not a problem, but it seems to fragment memory. Because the JVM Hotspot requires continuous memory space, we realized that this fragmentation of memory leads to the use of swap space, which is not fragmented.
However, I'm not sure how much I understand the relationship between fragmentation and the requirement for continuous memory. Of course, fragmentation refers only to the fragmentation of the physical ram. With virtual memory, it is entirely possible to allocate a continuous piece of RAM without supporting its continuous part. In other words, a continuous piece of physical memory will be displayed in the current process as a continuous piece of virtual memory.
So, I think there was not a single question in this question, but does anyone know more about this and can call back? Any links citing this issue with contiguous memory on 64-bit systems?
What I have found so far:
So far, every link I found in the "continuous memory" problem has been more related to how the virtual address space is laid out on 32-bit address systems. Since we use a 64-bit system (with 48-bit addressing), there is a large amount of virtual address space to allocate large contiguous fragments.
I searched all the information on the Internet, but still could not find the information I am looking for.
Updates:
- To be clear, I did not try to get an answer to the question of why I get OOM errors, but I try to understand the relationship between the possible fragmented system RAM and the adjacent piece of virtual memory needed by java.
- prstat -Z
ZONEID NPROC SWAP RSS MEMORY TIME CPU ZONE 0 75 4270M 3855M 24% 92:24:03 0.3% global
- echo ":: memstat" | mdb -k
Page Summary Pages MB %Tot ------------ ---------------- ---------------- ---- Kernel 326177 2548 16% ZFS File Data 980558 7660 48% Anon 561287 4385 27% Exec and libs 12196 95 1% Page cache 17849 139 1% Free (cachelist) 4023 31 0% Free (freelist) 156064 1219 8% Total 2058154 16079 Physical 2042090 15953
kthr memory page disk faults cpu rbw swap free re mf pi po fr de sr vc vc vc -- in sy cs us sy id 0 0 0 2161320 2831768 12 55 0 0 0 0 0 3 4 -0 0 1089 1320 1048 1 1 98 0 0 0 819720 1505856 0 14 0 0 0 0 0 4 0 0 0 1189 748 1307 1 0 99 0 0 0 819456 1505648 0 1 0 0 0 0 0 0 0 0 0 1024 729 1108 0 0 99 0 0 0 819456 1505648 0 1 0 0 0 0 0 0 0 0 0 879 648 899 0 0 99 0 0 0 819416 1505608 0 1 0 0 0 0 0 0 3 0 0 1000 688 1055 0 0 99
These command exits were executed when the application was running in a healthy state. Now we track all of the above and register it if we again see paging space errors.
The following shows how the JVM grew to 8 GB and then was restarted. The effect of this is that ZFS ARC declined (to 26% RAM) until it increased again. How does it look now?
vmstat 5 5
kthr memory page disk faults cpu rbw swap free re mf pi po fr de sr vc vc -- -- in sy cs us sy id 0 0 0 1372568 2749528 11 41 0 0 0 0 0 2 3 0 0 713 418 539 0 0 99 0 0 0 3836576 4648888 140 228 0 0 0 0 0 0 0 0 0 1178 5344 1117 3 2 95 0 0 0 3840448 4653744 16 45 0 0 0 0 0 0 0 0 0 1070 1013 952 1 3 96 0 0 0 3839168 4652720 6 53 0 0 0 0 0 0 0 0 0 564 575 313 0 6 93 0 0 0 3840208 4653752 7 68 0 0 0 0 0 3 0 0 0 1284 1014 1264 1 1 98
total: 4341344k bytes allocated + 675384k reserved = 5016728k used, available 3840880k