Unable to use APR native sendfile support in Servlet
jonathandfields Sep 30, 2013 9:26 PMI am attempting to write a servlet that uses APR native sendfile support. I have tried it both with 6.1.0.Alpha and 6.1.0.Final. This is on RHEL 5 x86_64.
With 6.1.0.Alpha, the required native share libraries are bundled in modules/system/layers/base/org/jboss/as/web/main/lib. I set native="true" in standalone/configuration/standalone.xml in the web:1.4 section. I set logging to debug and verified the following:
21:11:55,604 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-15) Loaded: apr-1 21:11:55,605 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-15) Loaded: z 21:11:55,609 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-15) Loaded: crypto 21:11:55,609 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-15) Loaded: ssl 21:11:55,610 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-15) Loaded: tcnative-1 21:11:55,623 DEBUG [org.apache.catalina.core] (MSC service thread 1-15) JBWEB001068: Loaded native library 1.1.22 with APR capabilities: IPv6 [true], sendfile [true], random [true]
My servlet simply does this:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.info("sendfile.support = " + request.getAttribute("org.apache.tomcat.sendfile.support")); }
When the servlet is invoked, org.apache.tomcat.sendfile.support is null. According to the JBoss Web documentation, it should be true. In my application, when it is true, I send the content using the sendfile optimization.
I have experienced the same behavior with 6.1.0.Final, the only differencing being that the native libraries need to be downloaded from the Red Hat website and installed separately.
I have attached server.log.
I have successfully done this with earlier versions of JBoss AS, both community and EAP.
Any suggestions would be greatly appreciated as this is a critical piece of functionality that I must migrate forward.
Thanks!
-
server.log.zip 33.2 KB