Tomcat5.5 configuration and Performance Optimization

Source: Internet
Author: User
Tags domain name server
1. By default, Tomcat can use 128 MB of memory. In large application projects, this memory is insufficient and needs to be increased.

In Windows, add the following settings before the file {tomcat_home}/bin/Catalina. bat, UNIX, and {tomcat_home}/bin/Catalina. sh:

Java_opts = '-XMS [initial memory size]-xmx [maximum memory available ]'

You need to increase the value of these two parameters. For example:

Java_opts = '-xms256m-xmx512m'

Indicates that the initial memory is 256 MB, and the maximum memory available is 512 MB.

2. Operating System Performance Optimization

By default, the number of files opened in Windows is 2000, and that in Linux is 1024;

When VI/etc/profile is added to ulimit-N 4096, the maximum number of files opened in Linux is 4096.

3. disable DNS query

When a web application wants to record information about the client, it also records the IP address of the client or converts the machine name from the Domain Name Server to the IP address. DNS queries require network occupation, and include the process of obtaining the corresponding IP address from many servers that are far away or do not work, which consumes a certain amount of time. To eliminate the impact of DNS queries on performance, we can disable DNS queries by modifying the value of the enablelookups parameter in the server. xml file:

4. adjust these parameters in tomcat5. See the following table:

Attribute name Description
Maxthreads Tomcat uses a thread to process each received request. This value indicates the maximum number of threads that Tomcat can create.
Acceptcount Specify the number of threads that can be used to process requests, and the number of requests that can be placed in the processing queue. Requests that exceed this number will not be processed.
Connnectiontimeout Network Connection timeout, in milliseconds. If it is set to 0, it indicates that the request Never times out. This setting has potential risks. Generally, it can be set to 30000 ms.
Minsparethreads The number of threads created during Tomcat initialization.
Maxsparethreads Once the created thread exceeds this value, Tomcat closes the socket thread that is no longer needed.

5. The directory list is not displayed on the web.

Change listings to false in Web. xml.

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.