Visitors, Visitor Meta, Crons and Performance Problems
-
Hey team,
I was helping Chris @ https://shoptalkshow.com/ debug a performance problem, and we wanted to fill you in on what we think was happening.
The site was running WP eCommerce and the site would go unresponsive for big chunks of time – sometimes a few minutes – with the page eventually showing a 500 error. Upon debugging and trying to recreate the problem, I noticed a couple of things:
1. The
wpsc_visitors
andwpsc_visitormeta
tables were _massive_ – millions of rows each, dwarfing the other tables in the database.
2. The cron task to clean visitors was spawning several AJAX requests, which seemed to correspond with the downtime.We haven’t 100% pinned the problem down to the cron task, but disabling WP eCommerce seems to have solved our downtime issues.
I haven’t spent a ton of time investigating, but after looking at the cron code here is my (possibly totally wrong) theory:
The
wpsc_visitors
and relatedwpsc_visitormeta
table are growing too fast for the cron task to clean up. This is because the cron task limits the # of visitors it cleans on every run, and because it does it via separate AJAX requests the server gets hit with a burst of activity all at once. Because the visitor/meta tables never get fully cleaned, the problem will continue indefinitely.A couple of solutions to my theory:
1. Could the cron task just do the deletions via a single query, rather than breaking out each visitor into a separate AJAX request?
2. Could the cron task just grab a handful of rows from the visitor table? As I read it now, it grabs _every_ visitor’s ID and cycles through it. In our case, that’s millions of IDs, and could bog down a less-powerful server.I hope this is all helpful. Chris wanted you guys to have this info. I’m happy to answer questions. Thanks!
- The topic ‘Visitors, Visitor Meta, Crons and Performance Problems’ is closed to new replies.