How to return 503 server busy based on cpu/memory usage or pending requests?

It pretty much depends on what OS you are. If you are on linux, then it's quite easy to add 503 based on cpu/memory - use /proc/meminfo and uptime to figure loads and act as you wish. As for pending connections, that's more tricky and solution should be looked at apache level (given that your are apache).

Up vote 4 down vote favorite 1 share g+ share fb share tw.

I am working on high performance web application that uses jetty and jersey for REST. I am trying to find the best way to return 503 if CPU load, memory bandwidth or pending connections are high. Looking around the web I did not find much instructions on how to do it, and almost nothing on Jetty.

The way to do it is using proxy, filter, code in the servlet? Java jetty jersey http-status-code-503 link|improve this question asked Aug 31 '11 at 12:19mbdev411211 69% accept rate.

It pretty much depends on what OS you are. If you are on linux, then it's quite easy to add 503 based on cpu/memory - use /proc/meminfo and uptime to figure loads and act as you wish. As for pending connections, that's more tricky and solution should be looked at apache level (given that your are apache).

My 2 cents.

If the server is busy, perhaps it would not even be able to get to the code that returns 503. – mbdev Sep 1 '11 at 7:09 well, if you have high loads, I would suggest setting up proper cluster. Then then balancer would watch after the nodes.

And in case no node is there to serve the request, it can bounce it back with proper message. Also, you might want to consider nginx - it has nice and simple way of handling high load situations. – jancha Sep 1 '11 at 7:38.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions