apache 将 APR 与 Tomcat 一起使用有什么好处(如果有)?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/751025/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 17:29:32  来源:igfitidea点击:

What is the benefit (if any) of using APR with Tomcat?

javaapachetomcatapr

提问by Marko

Tomcat has an option to use APR for handling connections. What are the benefits of using that? Does anyone have firsthand experience with it?

Tomcat 可以选择使用 APR 来处理连接。使用它有什么好处?有没有人有第一手的经验?

采纳答案by cherouvim

If you don't plan to use a web server (for serving static content) in front of Tomcat then APR is supposed to improve things.

如果您不打算在 Tomcat 前面使用 Web 服务器(用于提供静态内容),那么 APR 应该会有所改进。

I've only indirectly used it via JBoss Webbut I always prefer to have an Apache httpd fronting Tomcat, so I think APR then is irrelevant.

我只是通过JBoss Web间接使用了它,但我总是更喜欢在 Tomcat 前面有一个 Apache httpd,所以我认为 APR 是无关紧要的。

回答by Brian Agnew

Does thisanswer yor question re. benefits?

是否回答了您的问题?好处?

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.

Tomcat 可以使用 Apache Portable Runtime 提供卓越的可扩展性、性能以及与本机服务器技术的更好集成。Apache Portable Runtime 是一个高度可移植的库,它是 Apache HTTP Server 2.x 的核心。APR 有很多用途,包括访问高级 IO 功能(例如 sendfile、epoll 和 OpenSSL)、操作系统级功能(随机数生成、系统状态等)和本机进程处理(共享内存、NT 管道和 Unix 套接字)。

这些特性使 Tomcat 成为一个通用的网络服务器,将能够与其他本地网络技术更好地集成,并且总体上使 Java 作为一个成熟的网络服务器平台更可行,而不仅仅是一个以后端为中心的技术。

(my emphasis)

(我的重点)

回答by Randolf Richardson

I use APR with mod_perl2 and I have noticed a performance improvement. This performance improvement comes from using APR to directly access more than just system status and whatnot because APR is a highly optimized library that deals with cookies, headers, data types, etc., directly from the web server. It also provides direct access to all aspects of the connection that aren't typically otherwise available.

我将 APR 与 mod_perl2 一起使用,我注意到性能有所提高。这种性能改进来自使用 APR 来直接访问不仅仅是系统状态等,因为 APR 是一个高度优化的库,可以直接从 Web 服务器处理 cookie、标题、数据类型等。它还提供对连接的所有方面的直接访问,这些方面通常不可用。

I haven't used it with Java yet, but am trying to figure out how to get TomCat 6 to allow me to use it from JSP code. I expect to see increased efficiency by using APR directly from my Java code, just as I did with Perl.

我还没有将它与 Java 一起使用,但我正在尝试弄清楚如何让 TomCat 6 允许我从 JSP 代码中使用它。我希望通过直接从我的 Java 代码使用 APR 来提高效率,就像我使用 Perl 所做的那样。