Okay, I've read a small article on wiki which explained AJP a bit. Basically this protocol is used for communication between Apache and Application server. But why may one need it in the first place? Why not use just plain http?
More specifically, and not really covered in that ehow article, there's some non-trivial overhead to parsing http headers on requests and creating them on responses. If you are fronting your app server with a web proxy server, AJP allows you to skip that extra parsing and just pass efficient binary representations of the headers between the proxy server and the app server. There are other benefits with things like simple connection pools and tight integration if you use apache/mod_jk to tomcat.
Client <- http/s-> Proxy <- http/s -> App
vs
Client <- http/s-> Proxy <- AJP -> App
AJP (Apache Jserv Protocol) is basically a binary protocol that allows to reverse proxying requests from a FE Web Server to a BE Application Server, effectively propagating all the needed information to make the Req-Res flow continuing successfully. Often, AJP is used to load balance using sticky-session policies: thanks to the transferred header data, the FE Web Server can load balance over the BE counterparts making use of specific modules (like, mod_jk).
AJP is used mainly because:
- it's more performant than any HTTP exchange,
- it's integrated with broadly used reverse-proxying modules (i.e. mod_jk, mod_proxy),
- Tomcat's implementation provides a rich set of APIs that is protocol transversal: HTTP(s) data is seamlessly propagated, and can be retrieved with simple API calls (canonical getXYX(), very effective and immediate), so it's like working with HTTP at a higher speed.
Definitely, I'd say that it's a proven solution with almost 20 years of maturity on the shoulders: it's successfully used in production environments.
mod_jk
predates the use of HTTP in Apache JServ (a long-defunct product). Historically, mod_jk
provided many features not available through mod_proxy
. These days, these two products have roughly reached feature-parity, so momentum is really the only thing keeping AJP in high-usage. –
Courland Seems the answer I was looking for is perfomance
© 2022 - 2024 — McMap. All rights reserved.