Support » Plugin: WooCommerce » wp_woocommerce_sessions table growing very very large

  • Resolved WPChina

    (@wordpresschina)


    This post is related to the closed topic at https://wordpress.org/support/topic/huge-database-wp_woocommerce_sessions/

    Each day my wp_woocommerce_sessions table grows to over 100mb on a heavily trafficked site. Both the wp-cron and a server-side cronjob are not working to clear that out. I posted on the thread above about discussing this with a Woocommerce support person, but they only suggested I install a WP Control plugin.

    Is there another way I can automate the clearing of the sessions? Any other way to troubleshoot this issue?

Viewing 13 replies - 1 through 13 (of 13 total)
  • WPChina

    (@wordpresschina)

    The wp_woocommerce_sessions table is now more than 200mb after I cleared it on Friday (it is Monday now). See this:
    wpcommerce-sessions.png

    Any idea how to solve this problem?

    LNN

    (@ewan-norman)

    Same problem! following..

    WPChina

    (@wordpresschina)

    @ewan-norman I am working now directly with Automattic support team on finding the problem. I will let you know in the next week what happens and the info we find.

    Same problem with one website…

    Just checked sessions table 1.37gb currently, I’ve spent ages trying to find why the site is so slow suspect this may have something to do with it.

    Watching with interest.

    Regards,
    Phil.

    WPChina

    (@wordpresschina)

    I’m still working with Automattic to solve this. I agree it is a stability issue. Once I figured out I should manually clear that table couple times a day, my server load dramatically decreased and my outages (I use pingdom and WPMUDEV to both check for downtime) dropped from a 4-10 outages a day to zero outages. I will let you know more details soon.

    Plugin Support Jesse Pearson

    (@jessepearson)

    Automattic Happiness Engineer

    @wordpresschina Do you have a ticket number we can reference on this end to see what has been done? (I searched for your name and username and didn’t find anything)

    I took a quick dive into this and it appears that there should be a cron running twice a day to clear out expired sessions:


    Link to image: http://cld.wthms.co/hN3OqZ

    I see this in my store using WP Crontrol ( https://wordpress.org/plugins/wp-crontrol/ ). If you don’t see this in your store, then that’s part of the issue.

    Sessions are typically 48 hours, unless something has modified this via a filter. So if your site has a lot of traffic, it’s possible to have a large sessions table.

    WPChina

    (@wordpresschina)

    @jessepearson it is #1586156. I will respond to it with more details in the next 48 hours, so the delay is currently my fault.

    Yes I do see that too in my WP Control: http://www.screencast.com/t/6sJXQq7JZdwd

    Plugin Support Jesse Pearson

    (@jessepearson)

    Automattic Happiness Engineer

    @wordpresschina I see the ticket, it automatically set itself to solved due to no reply. I just updated it to Pending, so if you’d like to continue to have assistance, you will need to reply there.

    As for everyone else, please make sure that your cron schedules include the above and that WP Cron is functioning correctly.

    Plugin Support wbrubaker

    (@wbrubaker)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    WPChina

    (@wordpresschina)

    Ok but I was in touch with Automattic 18 hours ago on their continued checks on my server. They pinpointed one area we are now checking, but if it is the case then It won’t really solve the problem. What would solve the problem is allowing us to tweak and change the frequency by which sessions are automatically cleared, rather than needing to do it manually. But let me continue to work with Automattic on this to get a better idea.

    WPChina

    (@wordpresschina)

    Ok I think I solved it. We had custom code that was adding a product to the cart for both logged in and non-logged in users. We changed it to only allowed logged in users to add to the cart. This has dramatically dropped the sessions table to only about 10-15MB.

    However, I still suggest a method for an admin to alter the time when the cleanup is run. For example, an admin should be allowed to run it every 2 hours, if so desired.

    Plugin Support Jesse Pearson

    (@jessepearson)

    Automattic Happiness Engineer

    @wordpresschina You can use wp_schedule_event to trigger the woocommerce_cleanup_sessions action as often as you would like 🙂

    https://codex.wordpress.org/Function_Reference/wp_schedule_event

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.