Wednesday, March 14, 2012

JBoss 4.2.3 with Apache Portable Runtime (APR)

http://www.jboss.org/jbossweb/native

By default JBossWeb uses the standard pure-Java implementation and you can observe this in the log:

INFO  [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [...]
INFO  [Http11Protocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8080
INFO  [Http11Protocol] Initializing Coyote HTTP/1.1 on http-8443
INFO  [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-0.0.0.0-8009
INFO  [Catalina] Initialization processed in 1118 ms
INFO  [StandardService] Starting service jboss.web
INFO  [StandardEngine] Starting Servlet Engine: JBossWeb/2.0.1.GA
INFO  [Catalina] Server startup in 93 ms

where with native libraries installed it will look like this:

INFO  [main] [org.jboss.wsf.stack.jbws.NativeServerConfig:51] JBoss Web Services - Native
INFO  [main] [org.jboss.wsf.stack.jbws.NativeServerConfig:52] jbossws-3.0.1-native-2.0.4.GA (build=200803312044)
INFO  [main] [org.apache.catalina.core.AprLifecycleListener:181] Loaded Apache Tomcat Native library 1.1.22.
INFO  [main] [org.apache.catalina.core.AprLifecycleListener:189] APR capabilities: IPv6 [false], sendfile [true], accept filters [false], random [true].
INFO  [main] [org.apache.coyote.http11.Http11AprProtocol:113] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8080
INFO  [main] [org.apache.coyote.ajp.AjpAprProtocol:166] Initializing Coyote AJP/1.3 on ajp-0.0.0.0-8009
INFO  [main] [org.apache.catalina.startup.Catalina:536] Initialization processed in 992 ms
INFO  [main] [org.apache.catalina.core.StandardService:507] Starting service jboss.web
INFO  [main] [org.apache.catalina.core.StandardEngine:431] Starting Servlet Engine: JBossWeb/2.0.1.GA
INFO  [main] [org.apache.catalina.startup.Catalina:584] Server startup in 39 ms

To enable APR, download the appropriate package for the environment from http://www.jboss.org/jbossweb/native and extract into jboss\bin – in my case a Windows server, and that would be tcnative-1.dll and openssl.exe. They need to be in the application path, if it doesn’t find them JBoss will revert to standard Java implementation.

One problem now is that APR uses openssl.exe and the HTTPs configuration has to be changed, but I didn’t look too much into that, since my environment doesn’t require it I just commented it out; otherwise it will throw an exception at start-up complaining about the setup of the secure connector.

jboss\server\default\deploy\jboss-web.deployer\server.xml
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 <!-- Define a SSL HTTP/1.1 Connector on port 8443
      This connector uses the JSSE configuration, when using APR, the 
      connector should be using the OpenSSL style configuration
      described in the APR documentation
   <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
           maxThreads="150" scheme="https" secure="true"
           clientAuth="false"
           keystoreFile="${jboss.server.home.dir}/conf/ssl-keystore.jks"
           keystorePass="hgf8tx" sslProtocol="TLS" />
-->

Restart JBoss and check the performance.

2 comments :

  1. Hai
    May I know what are the changes that we have to make in server.xml for APR connector

    ReplyDelete
    Replies
    1. I don't remember having to change anything else from standard (I could have been wrong) and I haven't noticed any issues at the time. Unfortunatelly I don't have the environment anymore from 3 years ago, but we could try to discuss your problem - what exactly do you see not working? I assume you have installed the correct binary flavour to match your runtime JRE/JDK (x32 or x64).

      Delete