Tomcat - TCP Connector

tomcat

http://tomcat.apache.org/tomcat-6.0-doc/config/http.html

What is the purpose of the HTTP Connector?

The HTTP Connector element represents a Connector component that supports the HTTP/1.1 protocol. It enable Tomcat to function as a web server. A particular instance of this component listens for the connections on a specific TCP port number on the server. One or more such Connectors can be configured as part of a single Service, each forwarding to the associated Engine to perform request processing and create the response.

What is the purpose of the AJP Connector?

Tomcat also support AJP protocol, which is similar to FastCGI which enables the application server to reside on a server separate from the web server. For information regarding Tomcat AJP Connectors, click here.

connectionLinger:

It represent the number of seconds during which the sockets used by this Connector will linger when they are closed. Setting this attribute to -1 will disable connection linger. The default value for the BIO and AJP connectors is 100. The default value for the NIO connection is 25.

connectionTimeout:

It represent the number of milliseconds that this connector will wait, after accepting a connection, for the request URI line to be presented. The default value is 60000 (or 60 seconds)

keepAliveTimeout attribute:

It specifies the number of milliseconds this connector will wait for another HTTP request before closing the connection. The default value is to use the value that has been set for the connectionTimeout attribute.

maxKeepAliveRequests:

It specifies the maximum number of HTTP requests which can be pipelined until the connection is closed by the server. Setting this attribute to 1 will disable HTTP/1.0 keep-alive, as well as HTTP/1.1 keep-alive and pipelining. Setting this to -1 will allow unlimited amount of pipelined or keep-alive HTTP requests. If not specified, this attribute is set to 100.

restrictedUserAgents:

The value is a comma separated list of regular expressions matching user-agents of HTTP clients for which HTTP/1.1 or HTTP/1.0 keep-alive should not be used, even if the clients advertise support for these features. The default is an empty String (regexp matching is disabled).

disableUploadTimeout:

This flag allows the servlet container to use a different, longer connection timeout while a servlet is being executed, which in the end allows either the servlet a longer amount of time to complete its execution, or a longer timeout during data upload. If not specified, this attribute is set to true.

maxHttpHeaderSize:

The maximum size of the request and response HTTP header specified in bytes. If not specified, this attribute is set to 8192 (or 8KB)

executor:

A reference to the name in an Executor element. If this attribute is enabled, and the named executor exists, the connector will use the executor, and all other thread attributes will be ignored.

maxThreads:

The maximum number of request processing threads to be created by this connector, which therefore determine 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.

threadPriority:

The priority of the request processing threads within the JVM. The default value is 5 (the value of java.lang.Thread.NORM_PRIORITY constant). See the JavaDoc for java.lang.Thread class for more details.

port:

Specify the TCP port number

protocol:

Set the protocol to handle incoming traffic. The default value is HTTP/1.1 and configures the org.apache.coyote.http11.Http11Protocol. This is the blocking Java connector. If the PATH (Windows) or LD_LIBRARY_PATH (on most Unix systems) environment variable contains the Tomcat native library, the APR connector will automatically be configured. Please be advice that the APR connector has different settings for HTTPS than the default Java connector. Other values for this attributes are, but not limited to org.apache.coyote.http11.Http11Protocol (same as HTTP/1.1), org.apache.coyote.http11.Http11NioProtocol (non-blocking connector), org.apache.coyote.http11.Http11AprProtocol (the APR connector). Take a look at the Connector Comparison chart. The configuration for both Java connectors are identical, both for http and https. For more information on the APR connector and APR specific SSL settings, refer to the APR documentation

server:

Overrides the Server header for the http response. If set, the value of this attribute overrides the Tomcat default and any Server header set by a web application. If not set, any value specified by the application is used. If the application does not specify a value, then Apache-Coyote/1.1 is used.

enableLookups: Set to true if you want calls to request.getRemoteHost() to perform DNS lookups. Set to false to skip DNS lookup and return the IP address in String form. By default, DNS lookup is disabled.

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

bufferSize: The size (in bytes) of the buffer to be provided for input streams. By default, buffers of 2048 bytes will be provided.

socketBuffer: The size (in bytes) of the buffer to be provided for socket output buffering. We can specify -1 to disable the use of a buffer. By default, a buffer of 9000 bytes is used.

tcpNoDelay: If set to true, the TCP_NO_DELAY option will be set on the server socket, which improves performance under most circumstances. This is set to true by default.

compressableMimeType: The value is a comma separated list of MIME types for which HTTP compression may be used. The default value is text/html,text/xml,text/plain

compression: The acceptable values for this attribute are "off" (disable compression), "on" (enable compression), "force" (forces compressions in all cases), or a numerical integer value which is equivalent to "on" but specifies the minimum amount of data before the output is compressed. If the content length is not known and compression is set to "on" or more aggressive, the output will be compressed. If not specified, this attribute is set to "off". There is a trade-off between using compression (saving your bandwidth) and using the sendfile feature (saving CPU cycles). If the connector supports the sendfile feature (such as the NIO connector), using sendfile will take precedence over compression. The symptoms will be that static files greater than 48kb will be sent uncompressed. You can turn off sendfile by setting the useSendfile attribute, or change the sendfile usage threshold in the configuration of the DefaultServlet in the default conf/web.xml or in the web.xml of your web application.
maxHeaderCount: The maximum number of headers in a request that are allowed by the container. A request that contains more headers than the specified limit will be rejected. A value of less than 0 means no limit. If not specified, the default value is 100. For security reason, we may want to limit this number to a reasonable number such as 15. We may want to benchmark to determine the best value from the performance perspective.

noCompressionUserAgents: The value is a comma separated list of regular expressions matching user-agents of HTTP clients for which compression should not be used because they have broken implementation. The default value is an empty String (regexp matching is disabled).
maxParameterCount: The maximum number of parameters (GET plus POST) which will be automatically parsed by the container. A value of less than 0 means no limit. If not specified, the default value is 10000. Note that FailedRequestFilter filter can be used to reject requests that hit this limit.

maxPostSize: The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. This limit can be disabled by setting this attribute to a value less than or equal to 0. If not specified, the default value is 2097152 (or 2 megabytes).

maxSavePostSize: The maximum size in bytes of the POST which will be saved / buffered by the container during FORM or CLIENT CERT authentication. For both type of authentication, the POST will be saved / buffered before the user is authenticated. For CLIENT-CERT authentication, the POST is buffered for the duration of the SSL handshake and the buffer emptied when the request is processed. For FORM authentication, the POST is saved while the user is re-directed to the login form and is retained until the user successfully authenticated or the session associated with the authentication request expires. This limit can be disabled by setting this attribute to -1. Setting this attribute to zero will disable the saving of POST data during authentication. If not specified, this attribute is set to 4096 (4 kilobytes).

parseBodyMethods: A comma-separated list of HTTP methods for which request bodies will be parsed for request parameters identically to POST. This is useful for RESTful applications that want to support POST-style semantics for PUT request. Setting this attribute to a value other than POST causes Tomcat to behave in a way that does against the intent of the servlet specification. The HTTP method TRACE is specifically forbidden here in accordance with the HTTP specification. The default is POST.

allowTrace: This is a boolean value which can be use to enable or disable the HTTP TRACE method. If not specified, this attribute is set to false.

emptySessionPath: If set to true, all paths for session cookies will be set to /. This can be useful for portlets specification implementations. If not specified, this attribute is set to false. A side effect of setting this to true, is that if Tomcat creates a new session, it will attempt to use the cookie session id if supplied by the client.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License