Don't Forget to Clear Out Your Rails Session Data 4
For the last year or so, this blog has been running slow, slow, slow.
From time to time, I tried to figure out what was going on, but I figured that Typo upgrades were just causing things to slow down and use more and more memory.
Until tonight.
Tonight I did a database dump and it came to 44 MB.
There is no way I have 44 MB of content in this blog.
So I had a look at the dump and realized that I had close to 100000 sessions in the sessions table, and that there was a table for Sitealizer plugin that's no longer part of typo.
So after a drop of the Sitealizer table and a
rake db:sessions:clear
Typo is now using 20% of the memory it was using before, running much, much faster, and the database dump comes to a slim 476 KB in size.
So this is my reminder to myself (and everyone else) to be sure to clear out your sessions table from time to time.
why not just create a crontab that does this every week or month, or whatever is best for your site.
22 4 * * 0 ~/bin/somescript.sh
@netzdamon: Yep, already did that. Probably should have put it in the article.
Psst! Cookie based session store!
I made a crontab, and it makes the hardwork :)