• 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).

  • 相关阅读:
    cmd常用指令
    python笔记01-05
    python安装过程中的一些问题
    初始化spring容器的一种方式
    切入点范式
    spring的list注入多个值
    Statement和PreparedStatement有什么区别?哪个效率高?
    sql 的四种隔离级别
    简单的spring核心配置文件编写
    spring
  • 原文地址:https://www.cnblogs.com/huilei/p/9914081.html
Copyright © 2020-2023  润新知