JVM Heap Size setting

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.