[Mongrel] random cpu spikes, EBADF errors
Zed A. Shaw
zedshaw at zedshaw.com
Tue Oct 30 08:46:32 EDT 2007
On Mon, 29 Oct 2007 16:27:49 -0400
Robert Mela <rob at robmela.com> wrote:
> > When mongrel was working, it should send the reply back to LSWS
> before closing the socket.
> There's a string prepared for the purpose in mongre.rb
> ERROR_503_RESPONSE="HTTP/1.1 503 Service Unavailable\r\n\r\nBUSY".freeze
> It's a one-liner to send that to the socket before calling close.
No, that's not the best way to do this. Think for a minute. Mongrel is overloaded. It's having a hard time sending data. Now you want it to waste more time sending data?
The general practice that works best is when a server is overloaded it aborts connections it can't handle in order to get some free time to service more requests. This way existing pending requests get some service and in a load balancing situation the server can move on to the next available backend. The alternative in trying to handle all requests, even with small responses, will mean that nobody gets service.
In reality, I bet that LSWS doesn't try to move on to the next backend when the connection is aborted. If you think about this also, it means that when LSWS is behaving as a proxy, and one of your backends goes down, then LSWS won't adapt and will instead complain to the user.
A properly functioning proxy server that is behaving as a load balancer should try all servers possible several times until it either gets a response or has to give up because everything is down and/or it is overloaded as well.
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/
More information about the Mongrel-users