I ended up going with a solution which keeps track of the number of requests and sends a 503 when the load is too high. It's not ideal, and as you can see I had to add a way to always let continuation requests through so they didn't get starved. Works well for my needs: public class MaxRequestsFilter implements Filter { private static Logger cat = Logger.getLogger(MaxRequestsFilter.class.getName()); private static final int DEFAULT_MAX_REQUESTS = 7000; private Semaphore requestPasses; @Override public void destroy() { cat.info("Destroying MaxRequestsFilter");
Read full article from java - How do I limit the number of connections Jetty will accept? - Stack Overflow
No comments:
Post a Comment