[Mongrel] Error: Mongrel timed out this thread: too many open files

Emmett Shear emmett at justin.tv
Sun Jun 1 17:23:20 EDT 2008

At first, I thought I'd messed up something in the database too. But running
the *exact* same updates and inserts against the production database,
through the console, yields normal, fast results. The *only* place I see
these 30-40 second updates/inserts is from mongrels that have been under
load for a while; I don't see the slowness when running the exact same
things from console, or from the old FCGI setup.

What could be different about the doing the database queries in Mongrel that
could cause this? I'm not too clear on exactly how Mongrel differs from
FCGI, other than being faster and not using FCGI (the protocol). Could it be
possible that the database connections are longer lived, or somehow shared
between multiple threads, or something like that? I start with the
assumption Mongrel does things the right way, and that I've made some
mistake in configuring my application, but I'm at a loss as to where to
start looking.


On Sat, May 31, 2008 at 11:07 PM, Zed A. Shaw <zedshaw at zedshaw.com> wrote:

> On Sat, 31 May 2008 21:03:21 -0700
> "Emmett Shear" <emmett at justin.tv> wrote:
> > - Observe that updates and inserts in the database (postgres) are
> becoming
> > slow. And by slow, I mean 30-40 seconds for a simple insert or update
> where
> > it previously took less than 0.1 seconds. Load on DB server itself
> remains
> > nominal; less than 2 on an 8 core box. No error messages of importance
> that
> > I can see. Inserts and updates from other sources (script/console, psql)
> are
> > fast.
> Well, it sounds like your site already has some traffic.  Without
> getting into a remote debugging session, have you checked your indexes
> to make sure you're adding the right ones to the right columns?
> If you were say entering a ton of strings into a DB and then querying
> for them with insane LIKE clauses, you'd see this kind of behavior.  As
> you added more rows your app would get slower and slower.
> --
> Zed A. Shaw
> - Hate: http://savingtheinternetwithhate.com/
> - Good: http://www.zedshaw.com/
> - Evil: http://yearofevil.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/mongrel-users/attachments/20080601/78eec549/attachment.html>

More information about the Mongrel-users mailing list