Code

Opened 5 years ago

Closed 5 years ago

#11499 closed (invalid)

The default clean session will certainly not work with a huge session database

Reported by: batiste Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Keywords: cleanup, session
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Hi,

I have a huge session table that is about 1 month old.
I have is gigabytes of session data. I really doubt that the default cleanup will work properly.
I have to admit I didn't try but if the script has to collect gigabytes of session it certainly not gonna work.

Here is the script I use instead :

http://pastie.org/550367

What you guys think about that? Do you think it could make sense to integrate something like this instead of the default one or it's a bad idea?

Attachments (0)

Change History (5)

comment:1 Changed 5 years ago by JohnDoe

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Maybe you SHOULD have looked at the one in django-admin, because it is quite a bit more efficient than the one you got running there and is actually doing it the proper way.

What is does is just tell the database to delete any data older than expire_date instead of loading it all into python and parsing it like you're doing.

comment:2 Changed 5 years ago by batiste

Thanks for the advice, I will give the default script a try.

comment:3 Changed 5 years ago by batiste

Hi,

So I tried to launch the command yesterday, and it's always running. The SQL command is extremely slow. Mysql InnoDB is extremely slow with comparison on no indexed value.

I have no solution with this. I can't really add an index on the date live. Even the script I presented seems to create strange lock issues. The only solution I see is to create a new table and switch to it or drop the old one...

comment:4 Changed 5 years ago by batiste

  • Resolution invalid deleted
  • Status changed from closed to reopened

Here is a "kind" of solution that seems to work well for me:

http://pastie.org/554705

I don't like this script, but that seems to be the only thing that works for me.

comment:5 Changed 5 years ago by JohnDoe

  • milestone 1.2 deleted
  • Resolution set to invalid
  • Status changed from reopened to closed

Just because you forgot to add an index, does not make it a bug or anything which should be fixed or changed.

If the pasted solution works for you, use it, but please, stop reopening this ticket as this is not a general problem.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.