Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-12490

let session clean up in admin interface work without grinding db to a halt

    Details

      Description

      As documented elsewhere, there are some php configs where gc_probability is set to 0 (notably debian).
      The eZ session table will then grow continuously over time, and when the sysadmin sees that and clicks on "clean expired sessions" in the admin interface it is too late: deleting 3M rows from a table which is in constant use does not bode well with Mysql - most likely result is a very slooow ez for a couple of hours, followed by a rollback - and the table keeps growing...

      Solution: delete the expired sessions X rows at a time, committing after every chunk (eg 1000 or 10000).

      In order to do this:

      • modify ezsession.php as per the attached file
      • add an ini settings which specifies after how many session rows a commit should happen. I'd say 10000 is a good starting point, but of course admins can tune it according to their load
      • modify module setup/session to pass the new ini param to eZSessionGarbageCollector()
      1. 012490_ezsession_lockup_timout.diff
        8 kB
        Gaetano Giunta
      2. 012490_ezsession_lockup.diff
        2 kB
        André R
      3. 012490_ezsession_part2.diff
        10 kB
        André R
      1. ezsession_timout.gif
        8 kB

        Issue Links

          Activity

          Hide
          André R added a comment - - edited

          In reply to comment #044742
          The django stuff states that it took three hours to complete.

          As for the other stuff, that is already covered here:
          http://issues.ez.no/IssueView.php?Id=14489&activeItem=15#comment261809

          Show
          André R added a comment - - edited In reply to comment #044742 The django stuff states that it took three hours to complete. As for the other stuff, that is already covered here: http://issues.ez.no/IssueView.php?Id=14489&activeItem=15#comment261809
          Hide
          André R added a comment - - edited

          patch for ezsession part 2, fixes:

          • review comments by jr (constant for numbers)
          • review comments by jkn (use warning in template and better feedback)
          • use a even more conservative approach to delete sessions which is less prone to take long time and cause timeout (time slices expects sessions to be evenly distributed, and that is not always the case)
          • make sure cronjob and bin script clears basket data as well.012490_ezsession_part2.diff
          Show
          André R added a comment - - edited patch for ezsession part 2, fixes: review comments by jr (constant for numbers) review comments by jkn (use warning in template and better feedback) use a even more conservative approach to delete sessions which is less prone to take long time and cause timeout (time slices expects sessions to be evenly distributed, and that is not always the case) make sure cronjob and bin script clears basket data as well. 012490_ezsession_part2.diff
          Hide
          André R added a comment -

          012490_ezsession_part2.diff for trunk (4.3.0alpha1)

          Show
          André R added a comment - 012490_ezsession_part2.diff for trunk (4.3.0alpha1)
          Hide
          André R added a comment -

          Implemented part 2 in
          trunk (4.3.0alpha1) rev. 24390

          Show
          André R added a comment - Implemented part 2 in trunk (4.3.0alpha1) rev. 24390
          Hide
          ezrobot added a comment -

          This issue has been automatically closed due to the lack of activity over a long period of time. It is very likely that it is obsolete, but if you think it is still valid, do not hesitate to reopen it and mention why.

          Show
          ezrobot added a comment - This issue has been automatically closed due to the lack of activity over a long period of time. It is very likely that it is obsolete, but if you think it is still valid, do not hesitate to reopen it and mention why.

            People

            • Assignee:
              André R
              Reporter:
              Gaetano Giunta
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: