Configuring The HTTP Connector

Out of the box, the JBoss Web server uses the Java-based HTTP/1.1 (Coyote) connector for parsing HTTP requests and passes the request to the Web server engine.

The Java-based Coyote connector is a mature and extremely stable component and should be the choice for most situations, especially if you are just beginning to use JBoss AS.

Configuring the HTTP connector in JBoss

On highly loaded systems, however, you can opt for the newer APR HTTP connector, which potentially offers the highest level of performance improvement, by leveraging proven operating system–level optimization on it.

The native APR connector is not a complete connector in the strictest sense. It actually makes use of the standard Java-based connector for most of its operations. However, when the native code APR connector is enabled, the Java code will switch to native implementation for several performance-sensitive and scalability-sensitive operations.

If you want to build your career as a JBoss professional, then visit Mindmajix - A Global online training platform for the “JBoss Training”  Course.  This course will help you to achieve excellence in this domain.

The APR connector optimizes performance and enhances scalability through three main mechanisms:

  • Use of a sendfile kernel-mode call to send large static files directly from the buffer cache

  • Use of a single native code keep alive poller, to implement connection keep alive for a large number of connections

Installing the APR connector

JBoss AS is a pure Java application server and so the APR connector does not ship with the standard distribution. When you start the application server, you might have noticed the following log message:

15:50:39,187 INFO  [org.apache.catalina.core.AprLifecycleListener] (MSC service Thread 1-2) The Apache Tomcat Native library, which allows optimal performance in production environments, was not found on the java.library.path

As a matter of fact, the AprLifecycleListener tries to find the APR libraries at startup. Since we still haven’t added them to the server installation, the Web server will fall back to the standard HTTP/1.1 connector.

Installing the APR connector is just a matter of following a few simple steps:

First, download the JBoss Native connector (part of the JBoss Web project) from HTTP://WWW.JBOSS.ORG/JBOSSWEB/DOWNLOADS/JBOSS-NATIVE-2-0-9, taking care to choose the right native-built libraries for your operating system.

JBoss Web Native Connectors

Once downloaded, unzip the JBoss Native into the home folder of your JBoss AS distribution.

As you can see, the archive contains into the native folder some operating system libraries, which will be used to enhance the capabilities of the http connector. Here, for example, is the library that will be used for a Windows machine:

Windows http connector in JBoss

Now, since the APR is a native library, you need to make sure that it’s available in the java.library.path environment variable. There are already a few places where the JVM will look for native libraries, such as the JAVA_HOME/bin folder or (on Windows machine) the c: Windows32system32. You can either place the native library there or add its path into the startup script of the application server:

set “JAVA_OPTS=%JAVA_OPTS% -Djava.library.path=C:JBoss-as-7.0.2.Finalbinnative” Now, restart JBoss AS, which will now detect the presence of the native libraries and leverage them:

standalone.bat or standalone.sh

You will notice certain console output that indicates the presence of the APR:

Console output

Configuring the Web server resources

Now that we have covered the standard Web server configuration, we will look at the additional configuration options that are available, but not explicitly shown in the standalone.xml configuration file. The Web server configuration section is divided into two broad areas:

Static resources configuration: This includes resources, such as HTML pages and images

JSP configuration: This is used for pages that are dynamically generated by the Web container

We will deal with the two options in the following two sections.

MindMajix YouTube Channel

Configuring static resources

Static resources include that part of the Web application (notably html pages and images) that do not require processing by the Web container but just need to be rendered to the end-user. For large applications requiring the highest throughput, we suggest you configure Apache as a dispatcher for static resources. This will be explained in detail in Chapter 9, Load Balancing Web Applications, which discusses in depth load balancing applications.

For smaller projects, using JBoss for this purpose might be just as good, so we have included a sample static resources configuration which is based on the default values:

Frequently asked Jboss Interview Questions

sample static resources

And here is a table reinforcing the meaning of the single properties:

Properties and Meaning
Properties & Meanings

Configuring dynamic resources

Besides the configuration of static resources, you will more likely be interested in tuning the configuration of dynamic resources, such as JSP pages that are handled by the JBoss Web server. By default, there’s no jsp-configuration element. If you want to include it, you need to add it as a child element of the configuration section, just like for the static resources. Here’s a jsp-configuration that relies on default values:

Dynamic resources configuration

Most of the configuration section is targeted at providing additional information to developers and some minor optimization to applications running in production. You should be aware of the development attribute, which determines if your dynamic pages (such as JSPs) will be ultimately checked for recompilation using the check-interval time (in seconds). So, when developing your applications, you should generally set this element to true, and to false when running in production.

The full description of the jsp-configuration section element follows here:

jsp-configurationjsp-configuration 2jsp-configuration 1jsp-configuration 3
Explore Jboss Sample Resumes! Download & Edit, Get Noticed by Top Employers!

Job Support Program

Online Work Support for your on-job roles.

jobservice

Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:

  • Pay Per Hour
  • Pay Per Week
  • Monthly
Learn MoreGet Job Support
Course Schedule
NameDates
JBoss TrainingNov 19 to Dec 04View Details
JBoss TrainingNov 23 to Dec 08View Details
JBoss TrainingNov 26 to Dec 11View Details
JBoss TrainingNov 30 to Dec 15View Details
Last updated: 03 Apr 2023
About Author

 

Technical Content Writer

read less