Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2010
    Posts
    182
    Plugin Contributions
    0

    Default Sessions Table HUGE, bringing down site 1.5.1

    After getting disk cache going via file, our session table is growing to the point I have to truncate it every hour... with active carts going.

    Not sure why it's growing, I thought 1.5+ already takes care of old sessions.

    I tried a script to alleviate the strain on the server by running

    mysql> DELETE FROM sessions WHERE expiry < (UNIX_TIMESTAMP() - 30 * 60);
    Query OK, 0 rows affected (36.59 sec)

    Although it did not clean the table up. Any suggestions?

  2. #2
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Sessions Table HUGE, bringing down site 1.5.1

    Well, there is a function in ZC that takes an unused parameter that deletes sessions based on the current time. It appears that it uses the current time compared to the expiry time rather than a time offset like used above. In fact the 0 results provided there almost seem to indicate that the sessions *ARE* being deleted like they should be, but the rate of database access is out running the ability to maintain...

    The function to which I refer is: _sess_gc($maxlifetime)

    Pass any value as the $maxlifetime as it is not used inside the function. Not sure if upgrading would also solve your problem(s). Could also use the files instead of database.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Sessions Table HUGE, bringing down site 1.5.1

    Another question would be what kind of traffic is this database seeing? Is it shared among multiple stores? Might want to provide other server specs to try to help identify potential solutions.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Sessions Table HUGE, bringing down site 1.5.1

    You say the table is "HUGE".

    Can you give some more context ... like how big is "HUGE" in your mind?
    And, why do you believe you need to "truncate it every hour"? Why exactly are you doing that? What business "problem" is that attempting to solve?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,838
    Plugin Contributions
    31

    Default Re: Sessions Table HUGE, bringing down site 1.5.1

    ZC2.2.0alpha in production...I see that my sessions table is 660MB with 200,500+ rows!
    When restored locally it's 1GB.

    I've truncated that today...see what happens.
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

 

 

Similar Threads

  1. Redirect Loop Bringing My Site Down
    By bi11i in forum General Questions
    Replies: 5
    Last Post: 24 Apr 2012, 06:47 PM
  2. Replies: 6
    Last Post: 13 Mar 2012, 05:05 AM
  3. Paypal_Session Table is Huge
    By ksoup in forum PayPal Express Checkout support
    Replies: 13
    Last Post: 20 Mar 2010, 02:54 PM
  4. Replies: 0
    Last Post: 13 Nov 2007, 05:06 AM
  5. Replies: 6
    Last Post: 15 Aug 2007, 06:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg