[Mongrel] mongrel becoming unresponsive

Pete DeLaurentis pete at nextengine.com
Tue May 8 11:55:31 EDT 2007

Thanks for the info Kirk, and for letting us know about your logger  
plugin.  It sounds like exactly what I need.

I think I'll override Kernel.puts to use your plugin.


On May 8, 2007, at 8:47 AM, Kirk Haines wrote:

> On 5/8/07, Pete DeLaurentis <pete at nextengine.com> wrote:
>> Thanks for the explanation Luis.  This makes good sense.  It seems
>> like Mongrel is intercepting the stdout + sterr (puts it all into
>> mongrel.log), but it's not good to work with something that isn't
>> threadsafe.
> This probably begs some elaboration on just what puts() does.  It
> writes your string in one write operation, and does the newline in a
> second operation, which opens the possibility that Ruby can make a
> context switch between them.  If the newline is already in the string,
> though, it is just a single write operation.  You can also use write()
> instead of puts() to explicitly make sure that everything is done in a
> single write call.
> Take a look at the code in io.c for the details.
>> Makes me wonder if the rails logs are safe if you write to them from
>> different mongrels in a cluster.  Any experience with this?
> Even if it can be made "safe", contention from multiple processes
> trying to write to one file can be a non-trivial performance hit.
> This was one of my motivations for writing an async logger.  I want
> all of my app logs in the same place, even if I have multiple backend
> processes, without worrying about resource contention.  It's that, or
> I have N log files, one for each backend process for my app.
> Kirk Haines
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users

More information about the Mongrel-users mailing list