javajboss7.xmod-cluster

ModCluster configuration to discard request when load is full


I have a Java application which exposes REST.

I have a master and 2 slaves. (jboss7.1.1)

Apache-modcluster takes care of load balancing.

I have queues maintained in my application which gets filled up at times, when there are no consumers. Hence I get OutOfMemory and the slave node goes down.

Is there any configuration in apache modcluster to check the load and block incoming requests, inspite of just routing?

Or any different suggestion?


Solution

  • As far as I am aware you can only route requests based on load (using a LoadMetric), not block them

    I would suggest you should design you API to return a different response code (509 or 503 perhaps) when your queues are full and the jboss node is unable to service the request, you can then instruct the API consumers to try again after a timeout if they encounter one of these responses

    It is possible to 'rate-limit' apache using something like mod_security (see: https://johnleach.co.uk/words/1073/rate-limiting-with-apache-and-mod-security), however I think that controlling this from within your application code would be better