Skip to content

Apache AJP

September 11, 2009
tags:

ajp13 protocol is packet-oriented,binary format

connection pooling of socket conn’s take place. one conn per request. format of request/response – packet header.

from the site: Thoughts from Inside comment by Peter Booth:

mod_jk = reliability. for many mod_proxy is the better choice

mod_jk is stronger than mod_proxy:

1.Pool of 4 TomCat that are load balancing over.If one JVMs hangs say an application deadlock thenm you really don’t want it to receive requests. With mod_jk the worker corresponding to the hung tomcat will be disabled as soon as a timeout triggers and no requests will be forwarded until it is healthy again.

2.if a TomCat dies and is restarted automatically by, say, monit then mod_jk will detect that the persistent connection is dead and will recycle connections.

3. If one of your 4 Tomcat is being beaten on by a batch process and as a result has 80% CPU consumed. WIth mod_proxy this instance will be assigned 1/4 of requests and these requests may back up and give user sa bad experience while three other Tomcats have free resources. mod_jk load balance can consider busyness when balancing

4. If you have HA requirements that trump response time then mod_jk can ping the TomCat and be sure it is healthy before forwarding each request

5. If you have a firewall between your Apache and your Tomcat that is configured to terminate “dead” connections mod_jk can make use of TCP keepalive

6. If your Tomcat receives a request and hangs, what do you want the user to see? mod_jk allows you to define a timeout and return an error to the user quickly rather than make the user wait 90 seconds or more.

7. If mod_jk doesn’t get a response on a socket it might be the Tomcat thread bound to the connector socket. You can configure mod_jk to grab another connection and retry the request

8. If a JSP is being recompiled or a class being deployed live then its possible for tomcat to return a 404 when issued a valid response at the “wrong” time. mod_jk can avoid marking the tomcat as bad.

9. If the application is one that has occasional administrative queries that are very slow then mod_jk can be told to ignore a small number of slow requests without marking the tomcat bad

10. An admin console can used to mark a worker as disabled or stopped so that no requests or no new sessions are directed to that instance. Useful for rolling restarts to mitigate memory leaks, similarly if you know that your app has a memory leak that will cause it to fail after 3 days, and if the app takes ten minutes to startup then mod_jk can be configured to give a new Tomcat N minutes before trying to forward real request.

11. If you have an uber-cluster of 40 Tomcats then you can partition them so that session replacement isn’t a 40 way replication

12. hot standby tomcats can be preinstalled and will be preferentially chosen by mod_jk when a tomcat fails

13. If you have a commercial product than can only run on one tomcat host then you might want all requests of teh form /expensivegraph/plot to be directed to Tomcat 1 an dall other requests to be balanced across the pool. mod_jk supports this.

Mod_jk

* Pros:
      o Advanced load balancer
      o Advanced node failure detection
      o Support for large AJP packet sizes
* Cons:
      o Need to build and maintain a separate module (very insig?)
Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: