From time to time, all ruby programs become slow. By slow I mean, they run 2-3x time slower than usually. After restart everything backs to normal. Here are two outputs (first is "slow") from strace -T for process running specs: https://gist.github.com/1213292. Maybe it's not just ruby, but the whole system (which seems more likely), but this is only thing I noticed. It seems to be random, sometimes it happens few times a day and sometimes it's fine for couple of days and every time reboot fixes this. I have neither idea why does time spent in stat grows开发者_StackOverflow社区 that much, nor how to debug it further. Is it system (Ubuntu 11.04) thing, hardware (Intel 320 SSD) problem, something else?
the stat line also show errors, I'd be worried about hard drives...
On the typical VPS servers that I use (Slicehost and Linode), the squeaky slice gets the love.
In other words, Ruby/Rails programs can have large working sets. To keep them in memory, I ping every rest interface every 5 minutes (including Ajax rest interfaces). Keeps everything in memory, fresh and toasty warm.
So if by "time to time" you mean after a delay in sequential calls to your service, a pinger may be the answer.
精彩评论