0

I hope my question won't be closed for being vague, but the system I'm working with has a 455MB ci_sessions table with 150MB of overhead and I feel like the site is sluggish.

I think it could be in part because of that table that I think has lots of writing to it. It is currently using MYIsam engine. Would it be better to use InnoDB?

Also, would it be a good idea to set a cronjob to do OPTIMIZE TABLE ci_session? Would a smaller overhead speed up the website? And would it only last 5 minutes before the overhead is back to 150MB (I don't want to hit the optimize query before having an external opinion)?

NaturalBornCamper
  • 3,675
  • 5
  • 39
  • 58
  • 1
    It's almost always better to use InnoDB. [Have a look at this answer](http://stackoverflow.com/a/7492861/1071311) for a few reasons why. And why wouldn't you try your query out? Just run it and see for yourself if this has any effect and stop the time how long it takes to get back to the same amount of overhead. – Carsten May 21 '14 at 08:41
  • Another solution is to stop logging session for bots. Each time a bot accesses a webpage, it doesn't store the session cookie, and the framework creates a new session. – machineaddict May 21 '14 at 10:12
  • Thanks guys. @Carsten: I didn't want to try the query out so I could go from worst case scenario to best case scenario and better see if there was a difference. So now I'll optimize and switch to InnoDB. – NaturalBornCamper May 21 '14 at 10:49
  • @machineaddict I thought it was impossible to stop logging bots, that bots were always finding sneaky ways to pass for a user? I'll on google fo ideas. Unless you had suggestions? – NaturalBornCamper May 21 '14 at 10:51
  • found this, never heard about that config: http://stackoverflow.com/questions/20077751/codeigniter-session-spammed-by-bots – NaturalBornCamper May 21 '14 at 10:57
  • It's not impossible, as you can block most of them. I use a custom htacess file to block most of them. And periodically I update it. I got inspired by [this](http://docs.joomla.org/Htaccess_examples_%28security%29). And another thing, I use `innodb` for session table. – machineaddict May 21 '14 at 11:01
  • Awesome thanks a lot, I added a lot to my .htaccess after reading all this. Is it a bad idea also to an a regex in the session library to check if the user-agent contains "carwler" or "bot"? I would block so much more but I wonder if since nobody's doing this, it's because it's a bad idea (performance, block regular users) – NaturalBornCamper May 21 '14 at 11:49

0 Answers0