Increase Tomcat memory

Source: Internet
Author: User

 

Today I encountered a bug,

An error occurred while loading the project.

12,671: Error [http-8050-Processor24] (compiler. java: 407)-error compiling file:/D:/tomcat 5.0/work/Catalina/localhost/Unicom/org/Apache/jsp \ index_jsp.java [javac] compiling 1 source file

Insufficient system resources.

For more information, see Stack tracing below.

Java. Lang. outofmemoryerror: Java heap Space

Solution to this error:

About 176 lines under the Catalina. BAT file in the Tomcat \ bin folder

Under REM execute Java with the applicable properties, replace all % catalina_opts % with-xms256m-xmx512m. they indicate the minimum memory and the maximum memory respectively. the maximum Tomcat memory can only be changed to 80% of the physical memory.

---- Write it by the way

Tomcat 5 common optimization and Configuration
1. JDK memory optimization:
By default, Tomcat memory is 128 MB. In Windows, the file {tomcat_home}/bin/Catalina. in bat and UNIX, the file {tomcat_home}/bin/Catalina. before SH, add the following settings:
Java_opts = '-XMS [initial memory size]-xmx [maximum memory available] Generally, you should use 80% of the physical memory as the heap size.
2. connector optimization:
In the configuration in the tomcat configuration file server. XML, the parameters related to the number of connections include:
Maxthreads:
Tomcat uses a thread to process each received request. This value indicates the maximum number of threads that Tomcat can create. The default value is 200.
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. The default value is 10.
Minsparethreads:
The number of threads created during Tomcat initialization. The default value is 4.
Maxsparethreads:
Once the created thread exceeds this value, Tomcat closes the socket thread that is no longer needed. The default value is 50.
Enablelookups:
Whether to reverse query the domain name. The default value is true. To improve the processing capability, set it to false connnectiontimeout:
Network Connection timeout. The default value is 60000. Unit: 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.
Maxkeepaliverequests:
Number of requests to be retained. The default value is 100.
Buffersize:
The input stream buffer size. The default value is 2048 bytes.
Compression:
Compression and transmission. Optional values: On, off, and force. Default Value: off.
The parameters related to the maximum number of connections are maxthreads and acceptcount. To increase the number of concurrent connections, increase these two parameters at the same time. The maximum number of connections allowed by the Web server is also subject to the kernel parameter settings of the operating system. Generally, Windows has about 2000 connections, and Linux has about 1000 connections.
3. How to disable and allow files in the column directory in Tomcat
In {tomcat_home}/CONF/Web. XML, set the listings parameter to false, as shown below:

4. How to disable and allow access from hosts or IP addresses in Tomcat

This is the server configuration
Java_opts = '-server-xms512m-xmx768m-XX: newsize = 128 M-XX: maxnewsize = 192 m-XX: Export vorratio = 8' (t002)

Increase Tomcat connections:
In the configuration in the tomcat configuration file server. XML, the parameters related to the number of connections include:
Minprocessors: Minimum number of idle connection threads to improve system processing performance. The default value is 10.
Maxprocessors: Maximum number of connection threads, that is, the maximum number of concurrent requests. The default value is 75.
Acceptcount: Maximum number of connections allowed. It must be greater than or equal to maxprocessors. The default value is 100.
Enablelookups: whether to check the domain name. The value is true or false. Set to false to improve processing capability.
Connectiontimeout: the network connection times out. Unit: 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.
The parameters related to the maximum number of connections are maxprocessors and acceptcount. To increase the number of concurrent connections, increase these two parameters at the same time.
The maximum number of connections allowed by the Web server is also subject to the kernel parameter settings of the operating system. Generally, Windows has about 2000 connections, and Linux has about 1000 connections.

 

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.