`
lijuntian526
  • 浏览: 47765 次
  • 性别: Icon_minigender_1
最近访客 更多访客>>
社区版块
存档分类
最新评论

Tomcat 5.5 的 Apache Tomcat Native library

阅读更多

首先启动 Tomcat 5.5.20 的时候总是会显示这样的 log, 我用的是 Windows 版本:

2006-12-22 15:04:41 org.apache.catalina.core.AprLifecycleListener lifecycleEvent

信息: The Apache Tomcat Native library which allows optimal performance in produ
ction environments was not found on the java.library.path: E:\_PortableJava\JDK1
.6.0\bin;.;D:\WINDOWS\Sun\Java\bin;D:\WINDOWS\system32;D:\WINDOWS;

...

信息: Server startup in 2078 ms

那么我们去下载tcnative-1.dll后放在 Tomcat 的 bin 目录下, 启动后就会输出这样的信息:

2006-12-22 15:03:03 org.apache.coyote.http11.Http11AprProtocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2006-12-22 15:03:03 org.apache.coyote.ajp.AjpAprProtocol init

...

信息: Server startup in 1938 ms

可 以看到 Tomcat 启动的速度明显加快了, 甚至在加载了应用之后也是如此. 那么 Apache Tomcat Native library 是干什么的呢? 原来这是 Apache 为了提升 Tomcat 的性能搞的一套本地化 Socket, Thread, IO 组件.

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).

These features allows making Tomcat a general purpose webserver, will enable much better integration with other native web technologies, and overall make Java much more viable as a full fledged webserver platform rather than simply a backend focused technology.

也就是说它有高级 IO 功能, 操作系统级别的功能调用, 以及本地进程处理等等, 这些都能使 Tomcat 更像一个 Web Server(像Apache那样), 而不是只能用来解释 JSP, 也就是说提升单独的 Tomcat 作为服务器的吞吐性能.

如何检查有没有启用这些功能呢? 参考1.2中的链接的介绍:

一 旦这些组件正确的安装并且可供java调用 (如果加载失败, 库文件路径将被显示在控制台), Tomcat 连接器将自动使用 APR 功能. APR连接器的配置与普通连接器的配置基本相同, 但是提供了一些扩展的属性供APR组件使用。 注意:默认值已经适用于大多数的应用场景, 额外的调整不是必须的。

当APR可用之后, 以下特性将在Tomcat中可用:

  • Secure session ID generation by default on all platforms (platforms other than Linux required random number generation using a configured entropy)
  • Tomcat进程的内存占用率和CPU占用率将被 status servlet 显示。

有个简单的办法, 就是点击 Tomcat 启动后首页的 Status, 可以看到启用了 APR 之后多出了下列信息:

OS

Physical memory: 1022.45 MB Available memory: 433.33 MB Total page file: 2472.66 MB Free page file: 1196.89 MB Memory load: 57
Process kernel time: 0.812 s Process user time: 4.656 s
JVM

Free memory: 0.94 MB Total memory: 8.66 MB Max memory: 63.56 MB

参考资料里面有一些台湾人士的测试报告.

参考资料:

  1. Apache Portable Runtime and Tomcat http://tomcat.apache.org/tomcat-5.5-doc/apr.html http://tomcat.jaxmao.org/apr.html(部分中文翻译)

  2. 下载地址: http://tomcat.heanet.ie/native/1.1.8/binaries/win32/ 只需要 tcnative-1.dll .
  3. Tomcat 的 APR 連接器簡易測試 http://www.javaworld.com.tw/jute/post/view?bid=9&id=139958&sty=1&tpg=1&age=0
  4. Native Tomcat in SLAX http://blog.extremepattern.com/articles/2006/09/11/native-tomcat-in-slax
分享到:
评论

相关推荐

    最新的tomcat 和apache 整合 集群 优化

    - `-Djava.library.path=/usr/local/apache2/apr/lib` ##### 7. 修改 Apache 配置 最后一步是修改 Apache 的配置文件,使其能够作为代理服务器,将动态内容请求转发给 Tomcat。具体的修改步骤如下: 1. **定位...

    有关tomcat5.5.28的windows下的apr配置BUG,官方没有对应的tcnative-1.dll文件

    这个文件是Tomcat APR连接器(Tomcat Native Library)的一部分,它允许Tomcat直接与操作系统的底层API交互,从而获得更好的性能。 在配置Tomcat 5.5.28以使用APR时,通常需要以下步骤: 1. **下载tcnative**: 首先...

    RHEL5.5 安装HTTP2.2、TOMCAT6、JDK1.6、MYSQL5.5、PHP5详细步骤和遇到的问题

    在本文中,我们将详细探讨如何在RHEL5.5系统上安装HTTP服务器(Apache HTTPD 2.2)、Java开发工具包(JDK 1.6)、Tomcat 6应用服务器、MySQL 5.5数据库以及PHP 5,并解决安装过程中可能遇到的问题,如MySQL远程访问...

    tomcat5.5.20

    为了使Tomcat能够使用native library,用户需要将libapr-1.dll(Apache Portable Runtime库)放在系统的system32目录下,这是因为这个库是Tomcat运行时需要的,用于处理线程和其他操作系统级别的功能。 三、启动与...

    JSP安装运行步骤及遇错处理方法(全集)

    JSP安装运行步骤及遇错处理方法,包括安装JDBC步骤、安装Tomcat步骤、JAVA连接SQL2005的问题以及安装运行过程中...tomcat 5.5 的The Apache Tomcat Native library which allows optimal performance 的解决方法等等..

    Tomcat安裝APR指南

    本指南旨在提供在Red Hat Enterprise Linux 5.5+系统上为Tomcat安装Apache Portable Runtime (APR)的详细步骤。APR是Apache HTTP服务器项目的基石,它提供了操作系统级别的接口,使得Tomcat能够更好地利用系统资源,...

    tcnative-1.dll

    The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: ...... 意思是说在产品环境下可以优化工作性能的Tomcat的本地包没有找到...

    Struts2+Spring3+MyBatis3完整实例

    - The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: E:\Java\jre1.5.0_17\bin;.; - Initializing Coyote ...

Global site tag (gtag.js) - Google Analytics