开发者

Active Record extremely slow after being idle for a few hours

I have a Rails 3 app with about 11,000 rows of Podcasts and about 600,000 rows of Episodes in a SQLite database. It is currently in开发者_高级运维 development and I'm the only client accessing the server.

When I get home from work at the end of the day and make the first request to a podcast's episodes view, the request takes about 10 times longer than usual. The second request, however, takes the normal amount of time.

I'm not hugely concerned about this specific issue but I'm pretty confident that it's endemic of other issues that may arise when I eventually deploy this app.

Should I switch to MySQL or a nosql database? Is there anything else I can do?

EDIT: I should add that I'm running Mac OS X web sharing with Passenger as my server.

Thanks,

Harris


If you're using Passenger or some kind of application launcher you might find that the Rails process gets pruned off when idle for extended periods of time. The whole app has to be restarted on the first request, but would perform normally after that.

This is typical of sites that don't get a lot of traffic. You can artificially stimulate a bit of traffic using a cron job and curl of course.

Usually you can tell if this is the case by looking at your process list and seeing if the Rails process is still running.

This will affect even applications with no database.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜