[Mongrel] Performance leak with concurrent requests on static files (Rails)
zedshaw at zedshaw.com
Thu Jun 15 12:22:27 EDT 2006
On Thu, 2006-06-15 at 16:49 +0200, Francois Simond wrote:
> I just found something weird for mongrel with static files.
> Performance endlessly decreases if mongrel serve static files from
> simultaneous requests :
> Here is the test setup:
> Ruby on Rails
> Mongrel (tested with 18.104.22.168 and 1.3.13-pre installed today)
> Ubuntu dapper, compiled ruby 1.8.4.
> http client :
> while true; do ab -n 1000 -c 30 http://localhost:3000/ 2>/dev/null |
> grep quest.*mean ; echo -- ; done
Fantastic. You may have found the slow socket leak I couldn't
replicate, all thanks to ab's horribly implemented client protocol
(you'd think guys who wrote the most popular web server could write a
well behaved testing tool).
ab basically makes a ton of connections when concurrency > 1, and then
when it runs out of time it just closes the connection causing an EPIPE
on the socket.
Mongrel seems to not be closing the socket when this happens--which I
have to investigate. The slowdown you're seeing comes from sockets that
never close slowly filling up the 1024 available sockets for the
internal select call. As this fills up Mongrel gets less and less space
to deal with connections until it finally dies.
Thanks for tracking this down, I'll have it fixed today.
Zed A. Shaw
More information about the Mongrel-users