Impact of Java JVM settings on performance [reprint]

Source: Internet
Author: User

a backend server with the OS of slackware 8.1 and tomcat 4.1.30 is installed. It often crashes during busy periods. The dead state is "Java. lang. outofmemoryerror: Unable to create new Native thread ". Tomcat cannot create a new thread to respond to the request. So I set up an environment to test this problem. The memory is 2 GB, the CPU is 4 2.8 GB, and tomcat 4.1.30. Write a simple JSP page, as shown in the following figure:

Code
<%
try
{< br> thread. sleep (30000);
out. println ("fuck");
}catch (interruptedexception e) {
E. printstacktrace ();
}< BR >%>

 

Then press jmetor, and enable jconsole to monitor tomcat, and continuously adjust the xmx, XMS, and XSS parameters. The following table is displayed:

Number of Tomcat threads when xmx xms xss is down
500 m 500 m 128 K 642
800 m 800 m 64 K 485
1024 M 1024 M 64 K 374
1024 M 1024 M 128 K 374
1024 M 1024 M 512 K 371

According to this table, we can see that with xmx, the larger the memory size allocated to JVM, the smaller the number of threads that Tomcat can open, and the XSS parameter hardly affects any test results. I guess Tomcat uses Linux memory instead of JVM memory for thread opening. The larger the memory allocated to the JVM, the smaller the memory that the operating system can allocate, and the smaller the number of threads that can be opened.
Do you have any solutions? Have you ever encountered this problem? My idea is that each initial Linux Process (that is, the Tomcat thread) has an initial size. This should be a Kernel Parameter. You can just tune it down, but I don't know how to adjust it.

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.