본문 바로가기

개발/Server Side

톰캣 튜닝 참고 자료

http://www.tomcatexpert.com/sites/default/files/PerformanceTuningApacheTomcat-Part2.swf


대충 요약해보면....


In highly concurrent environments turn off KeepAlive


which Connector?

  - BIO (default. 웬만하면 이거 사용)

  

maxThreads

  - typical range 200-800

  - maximum # of concurrent! requests

  - for BIO, max # of open/active connections

  - good starting value 400

  

maxThreads="400"

- decrease if you see heavy cpu usage

  * application might be cpu bound instead of IO bound

  * find out what is causing CPU usage

- increase if you don't see much CPU usage

  * applications could be synchronized -> no gain

  * take into account other resources, such as database connections

  

maxKeepAliveRequests

- typical values 1, 100-200

- represents # of requests tomcat will handle on a TCP connection

- Set to 1 disables keep alive

- connectionTimeout / kddpAliveTimeout controls the timeout in between requests

- set to 1 if

  very high concurrency

  not using ssl in tomcat

  using layer 4 load balancer

  using bio connector

-set to >1 if

  using ssl or low concurrency

  layer 7 load balancer with advanced features

  using APR or NIO connector

BIO connector automatically disable keep alive for high connection counts


acceptCount



------------

또다른 자료 추가


 Set JAVA_OPTS options

-server -Xms1024M -Xmx2048

-XX:+UseParNewGC

-XX:+UseConcMarkSweepGC

-XX:+CMSParallelRemarkEnabled


Option

Description

-server

Use server mode jvm

-Xms1024m

-Xmx2048m

-XX:+UseParNewGC

Uses an improved collection algorithm that takes advantage of multiple processor cores to sweep the young generation.

-XX:+UseConcMarkSweepGC

Enables the Concurrent Mark Sweep (CMS) algorithm to be used for managing the old generation.

-XX:+CMSParallelRemarkEnabled

Enables multiple parallel threads to participate in the remark phase of the CMS algorithm.




Set Connector Options

  <Connector port="8080" protocol="HTTP/1.1"

  maxKeepAliveRequests="10"

  enableLookups="false"

  maxThreads="1024"

  connectionTimeout="3000"

  acceptCount="10"

  redirectPort="8443" />

Option

Description

connectionTimeout

The number of milliseconds this Connector will wait, after accepting a connection

maxKeepAliveRequests

The maximum number of HTTP requests which can be pipelined until the connection is closed by the server.

If the server use https, you can use keep-alive for performance.

enableLookups

En/disable DNS lookup.

maxThreads

The maximum number of request processing threads to be created by this Connector

Depending on CPU, Memory usage.

connectionTimeout

The number of milliseconds this Connector will wait, after accepting a connection.

acceptCount

The maximum queue length for incoming connection requests when all possible request processing threads are in use.





Change

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.FileHandler

Add

1catalina.java.util.logging.FileHandler.pattern =${catalina.base}/logs/catalina.%g.log

1catalina.java.util.logging.FileHandler.limit = 20000000

1catalina.java.util.logging.FileHandler.count = 5