Implementing better caching technique

After playing a little bit with memcache I had to implement better caching technique. Site was down for some hours, I look what happened…it was an error, which I didn’t see any time before…

Problem was with session table – it is stored in mysql. In log I saw something is not goot with session table, so I tried to repair it. After myisamchk I saw something is wrong with inodes…First I checked, if hdd is not full – no, there is more than 100 GB of free space. I am not unix guru, so I didn’t know what exactly is inode. Google helps again, so I checked free inodes with df -i, and yes – no inodes was free. For you, who doesn’t know what inode means – read more at wikipedia. Problem is – current cache implementation cached into files – in dir structure like this: cache/af/1b/4c/2d/af1b4c2d…gz – on hdd was so many files, no inode was free to make another file. This was serious problem, so I deleted some portion of cache and start thinking of better implementation, because this one has own fallbacks – for example deleting whole cache takes 1 week or so…strange,eh ?
So I decided to implement cache into MySQL, it has own drawbacks too, but it should work better in general. We will see, if it was good decision 🙂

Show archived comments
  1. Memcache can also be used for storing sessions, just put session.save_handler = memcache in your php.ini

    Its faster then mysql but you lose all sessions when you restart the memcache deamon.

    Thanks for the good work guys, keep it up!

  2. thanks anonymous for nice comment. Yes, it seems storing sessions into memcache is really good idea. I will experiment with that 🙂

( 2 Responses )

Read more

The Power of Subtitles in Advertising

In an era where global content consumption is at an all-time high, “Open Subtitles” taps into an underutilized advertising medium.