2

The website just went down, restarted the server and within a minute it went down again.

I quickly found out the problem was that the disk quota had been exceeded and allowed memory exhausted.

This was due to hundreds of thousands if not millions of sess_* files in var/session folder.

I tried lots of ways to remove them and this is what worked:

find . -name 'sess_*' | xargs rm

My Website is now back in good condition and no errors for now but within minutes I can see there are over 500 new session files.

Is this normal?

What should I do to prevent the server going down?

1

It sounds to me like you might have been hit by heavy load potentially. You might not be able to effectively handle a sudden spike without some form of load balancing and auto scaling such as using AWS and multiple servers.

However, alternatively it could just be that it grew to excessive size because nothing is cleaning up the sessions.

I would recommend you consider switching to use Redis as a caching service for sessions. Redis comes with a build in TTL on sessions and as a consequence of this, old sessions would simply drop from the database and stop filling the hard drive with old files.

Official Documentation:

Magento 1: http://devdocs.magento.com/guides/m1x/ce18-ee113/using_redis.html

Magento 2: http://devdocs.magento.com/guides/v2.0/config-guide/redis/config-redis.html

Hope that helps.

| improve this answer | |
  • Redis will also allow to recognize known bots and not creating sessions for them. – Jonathan Ribas Aug 29 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.