Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Explanation of Connector configuration in Tomcat

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

JBoss uses Tomcat as the Web container, so the configuration of the Web container in JBoss is similar to that in Tomcat, mainly for editing the server.xml file. In JBoss 5.x, this file is located under ${JBOSS.HOME}\ server\ ${confifure}\ deploy\ jbossweb.sar, where the value of configure can be all, default,web,standard, minimal, etc. The following code shows a server.xml in a JBoss default configuration, where comments have been removed due to space.

Host > Engine > Service > Server >

In the above configuration file, Server is the root node, and a Server represents a Servlet container, so in server.xml, there can be only one node, and under the Server node, there can be one or more Service nodes.

A Service node represents one or more Connector and an Engine, while Connector and Engine are two important configuration items in server.xml. The main function of Connector is to accept and respond to user requests. Commonly used Connector are HTTP/1.1 Connector and AJP Connector,HTTP/1.1 Connector, which are mainly used to deal with users' HTTP requests. It should be noted that although it is called HTTP/1.1 Connector, it is fully compatible with the HTTP/1.0 protocol. AJP Connector mainly uses the AJP protocol and Web Connector to communicate, and is usually used in clusters.

The instance of HTTP/1.1 Connector listens on the user-configured port. When the application server starts, HTTP/1.1 Connector is responsible for creating several threads to process user requests. The number of threads created depends on the user-configured minThreads value. The default is 5. When more user requests come, HTTP/1.1 Connector will create more threads to process requests. The maximum value of the creation thread is defined by maxThreads. The default value is 20. When all threads are busy processing user requests, new requests will be placed in the Socket queue created by HTTP/1.1 Connector. The length of the queue is defined by the acceptCount attribute. When the waiting queue is full, new user requests will receive a connection refused error.

All configuration items provided by Connector (incomplete version of scheme, isSecure, xpoweredBy, useIPVHosts):

AllowTrace if the server needs to be able to handle users' HAED/TRACE requests, this value should be set to true. The default value is false;emptySessionPath. If set to true, all session,cookie 's path will be set to /. This setting is usually useful in portlet, and the default value is false. If enableLookups needs to obtain the client machine name when calling the request.getRemoteHost () method, it needs to be configured as true. If configured as false, it will skip the DNS query and return the IP address of the client machine directly. In order to improve performance, this value is set to false, and the default value is true. The maximum size of the data that can be submitted by the maxPostSize POST method. If it is not declared or set to 0 or less, the size of the data submitted by POST is unlimited. The default value is 2Megabytes.protocol to set the protocol for handling requests, and the default is HTTP/1.1, that is, org.apache.coyote.http11.Http11Protocol. In addition, the protocols supported are: org.apache.coyote.http11.Http11NioProtocol (handling user requests through NIO, which can improve system performance) Org.apache.coyote.http11.HttpAprProtocol . ProxyName/proxyPort if the Web server uses a proxy server, configuring this parameter means that the name of the proxy server will be obtained when request.getServerName is called, and getServerPort () will return proxyPort. RedirectPort if Connector is configured to support non-SSL requests, when a SSL request arrives, the server automatically redirects the request to redirectPort. The encoding method when URIEncoding URI bytes are converted to String is ISO-8859-1 by default. If the page needs to support Chinese, it can be set to UTF-8 or GBK,GB2312. If useBodyEncodingForURI is set to true, the encoding of URI is determined based on the encoding of the page, and the default is false.

Configuration items provided by Http/1.1 Connector:

The length of the acceptCount wait queue. The default value is 100. Address if the host where the Tomcat resides has more than one IP, this value declares the IP address used to listen for HTTP requests. The size of the input stream created by bufferSize Connector. The default value is 2048 bytes. Increasing this value can improve performance and memory consumption. CompressableMimeType uses the MIME type of HTTP compression, separated by commas, and the default value is text/html,text/xml,text/plain. Compression to save bandwidth, you can set this value to on to enable HTTP/1.1 GZIP compression. Off disables compression, forces forces compression, and the default value is off. ConnectionTimeout Connector accepts the time to wait after a connection (milliseconds), and the default value is 60000. Executor under the Service node, in front of the Connector node, you can configure an Executor node to manage threads. The value of this attribute is the name of the configured Executor. If this attribute is applied and the executor exists, then any other configuration about thread will be ignored. KeepAliveTimeout before Connector closes the connection, Connector is the number of subtleties that another request Keep Alive waits, and the default value is the same as connectionTimeout. The maximum size of maxHttpHeaderSize HTTP request and response header information. Default is 8192bytes. If the maximum number of requests for maxKeepAliveRequests HTTP/1.0 KeepAlive and HTTP/1.1 KeepAlive / Pipeline is set to 1, KeepAlive and Pipeline will be disabled. If set to a number less than 0, the maximum number of requests for KeepAlive will be unlimited. The default is 100. The maximum number of threads that maxThreads uses to process user requests. The default value is 20. NoCompressionUserAgents: sets clients that do not use HTTP GZIP compression, separated by commas, and can use this property when some browsers do not support compression. The port on which port Connector listens. RestrictedUserAgents sets the client proxy name that does not use Keep Alive, separated by commas, and defaults to an empty string. Server overrides the serve header information of the HTTP response. If it is not set, the default value is Apache-Coyote/1.1. In general, you don't need to pay attention to this attribute. The size of the socketBuffer Socket output stream buffer, which defaults to 9000bytes, and if set to a value less than 0, this buffer is not used. The default value for tcpNoDelay is true, and setting to true can improve system performance. The priority of the threadPriority request processing thread, and the default priority is NORMAL.

Summary

The above is the whole content of this article. I hope the content of this article has a certain reference and learning value for everyone's study or work. Thank you for your support. If you want to know more about it, please see the relevant links below.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report