Set priority for specific requests in Apache webserver

apache-2.2

we have a website with CometChat integration for our users; since our apache server gets a lot of requests for the chat service, we'd like to set a different (lower) priority for these requests, while serving with an higher priority the other ones.

As far as we know, one way to do this could be using mod_qos, that would let us limit the number of requests in a period of time (eg reqs per second) for a specific path. This is not exactly what we'd like to do, but could be a partial solution.

My question is: is there a better solution to prioritize requests? If you suggest to use mod_qos, which would be a good configuration for mod_qos to achieve what I asked?

Thanks

Best Answer

It is not possible to prioritize requests within the apache web server directly.

That said, since apache contains a complete proxying and loadbalancing solution out of the box, there are lots of tweaks to be made with that.

You should probably look into proxying to separate backends (that can run on the same server) using ProxyPass

This would separate the requests for the chat service from other requests, and you can then decide on a proxy-by-proxy basis how much resources each backend has available to answer requests.

A full solution would be outside the scope of this format, but the apache documentation for mod_proxy will get you started; especially look into the ProxyPass options that allow you to set priorities and request limits per-backend.