reffec.com

Tomcat Web Server Tuning in Java Integrated barcode standards 128 in Java Tomcat Web Server Tuning

Tomcat Web Server Tuning using j2ee topaint barcode 128 on asp.net web,windows application ISO Standards Overview More in det Code 128A for Java ail, we will now start discussing the following topics: A short introduction to JBoss Web server and its core configuration files. How to configure the Connector element, which is the key element of the Web server performance. How to get the best results from modules, like mod_jk, which allow fronting JBoss Web server with Apache Web server.

. JBoss AS sh ips by default with an embedded Web server, which is behind the scenes the open source Web server Apache Tomcat (http://tomcat.apache.org).

The Web server is deployed as a Service ARchive (.sar) module and can be found in different locations depending on the release of the application server:. JBoss AS Re Code 128 Code Set C for Java lease 4.x 5.x and 6.

x Web server location <server>/deploy/jboss-web.deployer <server>/deploy/jbossweb.sar.

JBoss Web server basics The main co Code 128B for Java nfiguration file of JBoss Web server is server.xml, which contains the basic configuration and is located at the root of your Service ARchive. Each Web application is in turn deployed with a configuration file (named web.

xml), which defines per-application settings. If you need to share your application settings with other applications, you can fill in your configuration in the context.xml file, which is located at the same level as server.

xml. The key elements for tuning the Web server are the Connectors, which are used to collect incoming traffic from specific protocols. A quick look at the server.

xml configuration file reveals that two Connector elements are set up by default in every installation: An HTTP 1.1 Connector, used to receive requests coming from the HTTP protocol. This connector is normally adopted by applications running on a standalone installation of JBoss Web server.

An AJP 1.3 Connector, used to receive requests arriving from the Apache JServ Protocol. This connector is used in architectures where an Apache Web server (communicating through mod_jk or mod_proxy libraries) fronts JBoss Web server.

. Whatever ty pe of Connector is used by your application, the proper configuration of its resources is the groundwork for achieving good performance in your dynamic web applications. That"s what we will learn in the next section..

[ 230 ]. 8 . Configuring Connectors for optimal performance The built-i n Connector configuration contains a bare two elements section, which relies largely on default values:. <Connect Code128 for Java or protocol="HTTP/1.1" port="8080" address="${jboss.bind.

address}" connectionTimeout="20000" redirectPort="8443" maxThreads="300" /> <Connector protocol="AJP/1.3" port="8009" address="${jboss.bind.

address}" redirectPort="8443" />. In order to configure your JBoss Web server for optimal results, you need to pay attention to the following key properties:. Parameter m code 128 barcode for Java inSpareThreads maxThreads Meaning The minimum number of threads always kept alive, the default is 25. 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.

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.

The maximum time an idle thread will be available in the application server before being terminated. The default value is 60000 (60 seconds)..

acceptCount maxIdleTime These are t he default thread attributes used by the Web server planned for small/ medium loads. If you want your web applications to survive the challenge of heavy traffic, then you have no choice but to customize your Connector configuration. For example, in order to allow a maximum of concurrent 300 requests, then the following configuration would fit in:.

<Executo barcode standards 128 for Java r name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="300" minSpareThreads="15" maxIdleTime="60000" acceptCount="100" />. [ 231 ]. Tomcat Web j2ee ANSI/AIM Code 128 Server Tuning <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" address="${jboss.bind.

address}" connectionTimeout="20000" redirectPort="8443" />. If you are new to Tomcat 6.0 configuration, you might have noticed the new Executor element. As a matter of fact, the new 6.

x release of Tomcat Web server (embedded in the application server since release 4.2 of JBoss AS) use a shared Executor element to define one or more named thread pools. The thread pool configuration can thus be defined in the Executor element and later referenced in the Connectors, using the executor attribute.

. With this e jvm Code 128C xample configuration, if the number of concurrent requests is greater than the maxThreads attribute (300), they are stacked up to the configured acceptCount attribute. Any further simultaneous requests will receive Connection refused errors, until resources are available to process them. When some of the HTTP threads become idle for over the maxIdleTime (60000 ms), the Web server starts terminating the threads up to the minSpareThreads attribute (15).

As you can imagine, setting the correct number of threads generates a trade-off in several areas (performance/memory/CPU). Applications using a high number of spare threads will certainly reduce the costly operation of creating new threads. The reverse of the coin is that, using lots of threads can easily make your application CPU-bound due to excessive context-switching and will require more memory to be managed.

However, you can try to mitigate this problem by introducing a reduced thread stack, using the Xssn JVM parameter. The only safe way to find out the configuration "sweet spot" is by load testing your application and analyzing the outcome. The next section will show you how.

.
Copyright © reffec.com . All rights reserved.