The following configuration is primarily for the generational garbage collection algorithm.
Heap Size Settings
The setting of the young generation is critical
The maximum heap size in the JVM has three limitations: the data Model (32-BT or 64-bit) of the associated operating system, the system's available virtual memory limits, and the available physical memory limits for the system. Under the 32-bit system, the 1.5g~2g;64 is generally limited to memory unrestricted for the operating system. In Windows Server 2003 system, 3.5G physical memory, JDK5.0 under test, can be set to 1478m max.
Typical settings:
Java -xmx3550m-xms3550m-xmn2g –xss128k
-xmx3550m: sets the maximum available memory for the JVM to 3550M.
-xms3550m: set the JVM to drive memory to 3550m. This value can be set to the same as-xmx to avoid the JVM reallocating memory after each garbage collection completes.
-xmn2g: Set the young generation size to 2G. The entire heap size = younger generation size + old generation size + persistent generation size. The permanent average fixed size is 64m, so increasing the younger generation will reduce the size of older generations. This value has a large impact on system performance, and Sun's official recommendation is 3/8 for the entire heap.
-xss128k: sets the stack size for each thread. After JDK5.0, each thread has a stack size of 1M, before each thread has a stack size of 256K. The size of the memory required for the more applied threads to be adjusted. In the same physical memory, reducing this value can generate more threads. However, the operating system of the number of threads within a process is still limited, can not be generated indefinitely, the empirical value of 3000~5000 around.
JVM Heap Size setting