zoukankan      html  css  js  c++  java
  • tomcat性能优化

    分为几个大的方面

    1、系统设置

    2、JVM设置

    堆的大小

    3、tomcat配置

    主要是connector的相关属性

    最大连接数、队列大小等

    protocol

    Sets the protocol to handle incoming traffic. The default value is HTTP/1.1 which uses an auto-switching mechanism to select either a blocking Java based connector or an APR/native based connector. If the PATH (Windows) or LD_LIBRARY_PATH (on most unix systems) environment variables contain the Tomcat native library, the APR/native connector will be used. If the native library cannot be found, the blocking Java based connector will be used. Note that the APR/native connector has different settings for HTTPS than the Java connectors.
    To use an explicit protocol rather than rely on the auto-switching mechanism described above, the following values may be used:
    org.apache.coyote.http11.Http11Protocol - blocking Java connector
    org.apache.coyote.http11.Http11NioProtocol - non blocking Java connector
    org.apache.coyote.http11.Http11AprProtocol - the APR/native connector.

    Custom implementations may also be used.
    Take a look at our Connector Comparison chart. The configuration for both Java connectors is identical, for http and https.
    For more information on the APR connector and APR specific SSL settings please visit the APR documentation

    maxThreads

    The maximum number of request processing threads to be created by this Connector, which therefore determines the maximum number of simultaneous requests that can be handled. If not specified, this attribute is set to 200. If an executor is associated with this connector, this attribute is ignored as the connector will execute tasks using the executor rather than an internal thread pool.

    acceptCount

    The maximum queue length for incoming connection requests when all possible request processing threads are in use. Any requests received when the queue is full will be refused. The default value is 100.

    maxConnections

    The maximum number of connections that the server will accept and process at any given time. When this number has been reached, the server will accept, but not process, one further connection. This additional connection be blocked until the number of connections being processed falls below maxConnections at which point the server will start accepting and processing new connections again. Note that once the limit has been reached, the operating system may still accept connections based on the acceptCount setting. The default value varies by connector type. For BIO the default is the value of maxThreads unless an Executor is used in which case the default will be the value of maxThreads from the executor. For NIO the default is 10000. For APR/native, the default is 8192.
    Note that for APR/native on Windows, the configured value will be reduced to the highest multiple of 1024 that is less than or equal to maxConnections. This is done for performance reasons.
    If set to a value of -1, the maxConnections feature is disabled and connections are not counted.

    connectionTimeout

    The number of milliseconds this Connector will wait, after accepting a connection, for the request URI line to be presented. Use a value of -1 to indicate no (i.e. infinite) timeout. The default value is 60000 (i.e. 60 seconds) but note that the standard server.xml that ships with Tomcat sets this to 20000 (i.e. 20 seconds). Unless disableUploadTimeout is set to false, this timeout will also be used when reading the request body (if any).

  • 相关阅读:
    线段树刷题版
    HDU 1011 Starship Troopers 树形+背包dp
    POJ1741 Tree 树分治模板
    POJ3744 Scout YYF I 概率DP+矩阵快速幂
    【bzoj1875】【JZYZOJ1354】[SDOI2009]HH去散步 矩阵快速幂 点边转换
    BZOJ 3231: [Sdoi2008]递归数列 (JZYZOJ 1353) 矩阵快速幂
    POJ 2778 DNA Sequence AC自动机+矩阵快速幂
    POJ2222 Keywords Search AC自动机模板
    Python 命名空间
    svn下目录说明
  • 原文地址:https://www.cnblogs.com/huilei/p/9914081.html
Copyright © 2011-2022 走看看