I am more confuse, why the var/session folder is so big. I can see every minute there are 30-40 files being created. Is it a default Magento 2 behavior? How can I reduce the size because I don't want to log out all my customers and empty there cart all of the sudden. Please suggest.

2 Answers 2


Well.. files are created as sessions are created so it's a normal behavior. I would suggest you move the sessions to a service like Redis or Memcache. This will indeed mean that current sessions will be lost, but at least you won't face disk issues in the future. That's assuming you allocate a separate machine to the sessions and cache handling (you could pair the two and keep them on the same machine in different instances on different ports).


Other than what Diana suggested, check if your user are losing sessions and creating new ones repetitively, and if you have bad custom extension that is saving large data in session due to bad design.

Your customers will have to re-login after switching to redis, but they won't lose cart, cart is saved in DB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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