Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Session cleanup
  • Hi,

    can I set gc_probability to 0 and have this nightly script to cleanup the old sessions? Is this a safe/good way to do this? Or should I just let fuelphp do his work?

    #!/bin/bash

    max=7
    tmpdir=/tmp/session

    find ${tmpdir} -type f -name '*' -mtime +${max} -delete
  • Yes, you can.

    If you have enormous amounts of sessions it is even advised to do it manually, as it might have a protential performance hit on the frontend (apache) if gc kicks in.

    You have to find the balance on when to do it, obviously when using file based sessions, the more files you have in a single directory, the slower the I/O tend to get.
  • Per vhost I have a seperate session directory... I will disable GC in fuelphp and handle it with my own script...

    btw, there are a lot of small sessions created, with only rotated_session_id in it...
  • Session keeps a chain to deal with potential lost  sessions due to concurrent requests and id rotation.

    If a request comes in with an old session id, Fuel can use the chain to find out to which id the session was rotated to.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion