JBoss Memory optimization

Source: Internet
Author: User
Tags jboss xms


Yesterday looked at the data for a day, good luck, harvest is not small, solve a long-standing problem: JBoss memory tight problem. This is a problem that has plagued me for two years, that is, since the year before last, using JBoss 3.2.1 station has always been a big problem. A small site, 1G of memory is not enough, often to consume 500Mb of swap memory (swap).

Originally is oneself make very low-level mistake, do not understand java_opts the meaning of each parameter is caused. Before the java_opts was-xms 520m-xmx 1220m-xss 15120k +xx:aggressiveheap, this java_opts made 2 fatal mistakes:

1. +xx:aggressiveheap will make Xms 1220m meaningless. This parameter lets the JVM ignore the xmx parameter, eats up a G-physical memory crazily, and then eats up a g swap.
In addition, xmx as the maximum amount of memory allowed to be used by the JVM should not exceed 90% of the physical memory. And the reason why this parameter is used, because it is not added, JBoss will be running a day or so after the rapid collapse of the machine class is, or even appeared half an hour on the collapse of the situation.

The reason to use this parameter to run the server with swap is to make the following error:

2.-XSS 15120k

This allows JBoss to consume 15M of memory for each additional thread (thread), and the best value should be 128K, and the default value might be 512k.

This is when JBoss just started, there are 200Mb of memory surplus, but will run out quickly in one hours, because the server's threads is increasing rapidly. The first 3 days, eat more than 80Mb of swap every day. On the fourth day began to stabilize. This spring festival outside the holiday, observed this phenomenon, but do not understand the reason: after the server thread reached 100, generally no longer add new threads, the new increase in use, will be quickly destroy,1.25-2.10 the use of the thread is basically 1.21-1.23 created, Therefore, no new memory is consumed. The server continued to run, and thus greatly exceeded my 5-day expectation and reached 20 days.

The changes made yesterday:

1. Modify Java_opts, remove +xx:aggressiveheap, and modify XSS. Now the java_opts is:-xms 520m-xmx 900M-XSS 128k
2. Modify Deploy/jbossweb-tomcat55.sar/service.xml, MaxThreads based on current traffic from the default of 250 to 75, and use JBoss 4 The default is not written in the standard Service.xml and JBoss 3 writes 2 parameters: maxsparsethreads=55,minsparsethreads=25
3. The oracle-ds.xml has been modified to reduce the maximum number of connections by 150 to 50.
4. Removed some unused services.




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.