On an active server, Rails connections need to be throttled per IP, so a single user (or his all-too-common misbehaving robot) can't hog too many expensive Rails processes. I can't find any way to do this in lighttpd or nginx. This should be a throttle: if more than N connections from the same IP, stall the connection; when a connection from an IP finishes, start the next oldest one in the queue. This is particularly important when there are long-running Rails requests. It may apply to other systems, but Rails is a particular problem since it's so expensive to run more connections concurrently (since it's not threadsafe and has to spawn a whole new process each, eating way too much memory). The limit may be very low, eg. 2-3 per IP. This is much lower than a typical connection limit and should only apply to the limited Rails requests, not to static requests. mod_evasive can't do this; it just drops connections with an error.
on 26.04.2008 22:39

