Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am having some issues with an apache proxying to a local tomcat instance.

The i have traced the issue down to the way maxclients and proxypass direvtives interact.

in a test environment I set up apache to have 3 max clients and proxypass to have a max of 2 connections to the ajp connector.

maxclients 3
proxypass /player ajp://localhost:8009/player max=2

To illustrate the issue I have firewalled 8009 so requests will have to timeout If I then make 3 requests to /player and one to a non-proxied file ( 4 in total ) What I expect to happen is this:

  1. 1st request recieved and proxyied
  2. 2nd request received and proxied
  3. 3rd request recieved and as proxypass max reached request queued
  4. 4th request recieved and served as normal
  5. 1st request times out
  6. 3rd request taken from queue and proxied

However What actually happens is this:

  1. 1st request recieved and proxyied
  2. 2nd request received and proxied
  3. 3rd request recieved and waits for proxy connection to free
  4. 4th request recieved and queued as max clients reached
  5. 1st request times out
  6. 3rd request processed
  7. 4th request served

Does anyone know how to force the apache worker to re-queue a request when max proxy connections has been reached so it can move on to non proxied requests?

Thanks

Pete

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

As documented, you can set various additional paremeters to control the behaviour of mod_proxy.

The most useful for you will be:

acquire (no default)
If set this will be the maximum time to wait for a free connection in the connection pool, in milliseconds.
If there are no free connections in the pool then Apache will return SERVER_BUSY status to the client.

Set this to 0 so that when the pool is used up, it instantly returns a 503 status to the client.

share|improve this answer
    
Thanks for the reply adaptr, I did try using acquire but I get an error if I use a value of 0, Apache returned "ProxyPass Acquire must be at least one millisecond" and even if set to one it waits for timeout seconds before returning. –  peteches Jan 8 '13 at 13:35
    
So set it to 1. What you observe is probably due to a misconfiguration elsewhere. –  adaptr Jan 8 '13 at 13:48
    
Ok thanks, I'll have a gooseh around for any other issues in the config –  peteches Jan 8 '13 at 14:52
    
Ok just for the sake of completeness the reason the acquire option was being ignored is that acquire is a timeout for a free connection in the connection pool, however using the prefork MPM there is no connection pool created and therefore the option is irrelavent. –  peteches Jan 9 '13 at 10:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.