Tomcat 5.5.23 文档阅读Tips 12 APR and Tomcat

本文讲述APR(Apache Portal Runtime)和Tomcat. 

1. APR来源自apache项目,是apache 2.x中的一个核心模块。在Tomcat中使用APR,能带来性能的很大提升和高扩展性。因为ARP是使用很多native的方法,比如sendfile(使用sendfile就可以让用户下载大文件),epoll等(Linux系统下)。这里是原文的描述: 

Tomcat can use the Apache Portable Runtime to provide superior scalability, performance, and better integration with native server technologies. The Apache Portable Runtime is a highly portable library that is at the heart of Apache HTTP Server 2.x. APR has many uses, including access to advanced IO functionality (such as sendfile, epoll and OpenSSL), OS level functionality (random number generation, system status, etc), and native process handling (shared memory, NT pipes and Unix sockets). 

2. 在Tomcat下配置APR,在Linux系统下,首先要手动编译位于$CATALINA_HOME/bin目录下的tomcat-native.tar.gz包。编译这个包非常简单,configure, make, make install即可。不过在编译这个包的时候,需要首先安装如下的东西: 

    APR 1.2+ development headers (libapr1-dev package) 
    OpenSSL 0.9.7+ development headers (libssl-dev package) 
    JNI headers from Java compatible JDK 1.4+ 
    GNU development environment (gcc, make)


这里我没有实验,如果有需要的话将来可以回来实验这个APR。 

3. 当上述的包编译完成后,就会生成一些library,如果这些library能被tomcat的connector找到(如果找不到tomcat会打印寻找library的路径),那么connector就会自动变成APR enable的connector,从而提供高性能。文档的后半部分主要是在讲述APR enable之后的connector中的一些额外配置,有兴趣请直接参考文档,包括SSL的connector在APR下要做哪些额外的配置等。
原文地址:https://www.cnblogs.com/super119/p/1933306.html