From: Eric Wong Date: 2010-07-31T17:32:12+09:00 Subject: [ruby-core:31559] non-blocking I/O constantly clearing cache in 1.9.2 Hi all, The addition of IO::WaitReadable and IO::WaitWritable modules being extended into Errno::EAGAIN / Errno::EINPROGRESS exceptions means the method cache gets cleared every time those exceptions are raised. From my experience with non-blocking I/O, EAGAIN is a very common "error" and can be raised many times a second. Thus the method cache gets cleared constantly. While I don't write/maintain large Ruby applications with many methods, in them, I doubt the method cache would exist in Ruby if it didn't help performance, so constantly clearing it probably hurts some applications that run under 1.9.2. I don't yet know of any big apps doing non-blocking I/O (using Ruby IO methods like IO#write_nonblock/IO#read_nonblock) with lots of traffic running 1.9.2. If there are, it would be interesting to see if (and maybe how much) the following monkey patches help performance: class Errno::EINPROGRESS include IO::WaitWritable end class Errno::EAGAIN include IO::WaitWritable include IO::WaitReadable end Personally, I've never been a fan of caches. Yes, I use caches and even occasionally introduce them, but I still think they're ugly, last resort hacks. If the monkey patches above don't help performance a significant amount, maybe we could get rid of the method cache entirely :) -- Eric Wong