Rails site searching an awful lot of directories for files when starting up?
We were experiencing some intermittent slowness of various Rails sites on our server -- Apache 2, Passenger, REE 1.8.7, various Rails versions (mostly 2.3.11). Had a fellow come in and look around to see if he could find what we could optimize. He came back with this excerpt from an strace he did of a Ruby process: http://pastebin.com/t9LD89dr
As you can see, an awful lot of paths, some of them quite nonsensical, are being searched for this same file. Even though it's actually being found on about the 8th attempt. Apparently this is happening for many .rb files being included开发者_开发百科 by the app, resulting in a lot of wasteful disk activity.
Does anybody have an idea what's going on here and if we can do anything about it? I have a feeling this is what's slowing down the startup of our sites, which use a little in-house CMS we came up with. My first inclination is to blame Desert, which is used to allow us to develop plugin extensions to said CMS. But that's really no more than a guess. My other guess, after some fiddling around, is that this is that it's RubyGems. In any case, it makes restarting any app on our server r-e-e-e-a-a-a-l-l-l-l-l-y slow (and in the process, bogging down every other app on the server because of the way Passenger works) and something needs to be done about it.
Install 'will_paginate'; as it appears this gem is missing.
精彩评论