Bug #2566
closedExcessive Db queries?
0%
Description
I'm seeing the database get overloaded with requestes like this:
74440457 commons localhost commonswpm 8 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440458 commons localhost commonswpm 8 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440459 commons localhost commonswpm 8 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440463 commons localhost commonswpm 8 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440464 commons localhost commonswpm 8 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440468 commons localhost commonswpm 8 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440469 commons localhost commonswpm 8 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74439874 commons localhost commonswpm 9 Query SELECT SUM(u.c) c FROM (SELECT COUNT(DISTINCT(ip)) c FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `exclu 74440432 commons localhost commonswpm 9 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440436 commons localhost commonswpm 9 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440440 commons localhost commonswpm 9 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440442 commons localhost commonswpm 9 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440443 commons localhost commonswpm 9 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440447 commons localhost commonswpm 9 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440409 commons localhost commonswpm 10 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440418 commons localhost commonswpm 10 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440419 commons localhost commonswpm 10 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440423 commons localhost commonswpm 10 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440425 commons localhost commonswpm 10 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440426 commons localhost commonswpm 10 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440429 commons localhost commonswpm 10 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440431 commons localhost commonswpm 10 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440398 commons localhost commonswpm 11 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user 74440399 commons localhost commonswpm 11 Query SELECT COUNT(*) FROM `wp_15_firestats_hits` h,`wp_15_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user
Files
Updated by local admin over 11 years ago
Restarting the mysqld
and httpd
processes seems to have resolved the issue at least temporarily.
Updated by local admin over 11 years ago
- Status changed from New to Resolved
It's been a few minutes and things look normal again. Closing it as resolved.
Updated by local admin over 11 years ago
This is happening again. Looking into it.
Updated by local admin over 11 years ago
Slow queries log:
# Time: 130527 7:41:20 # User@Host: commons[commons] @ localhost [] # Query_time: 1.108230 Lock_time: 0.000084 Rows_sent: 1 Rows_examined: 745401 SET timestamp=1369654880; SELECT SUM(u.c) c FROM (SELECT COUNT(DISTINCT(ip)) c FROM `wp_184_firestats_hits` h,`wp_184_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user` = '0' AND `match_bots`='0' AND `site_id` = '1' AND 1 GROUP BY SUBSTRING(`timestamp`,1,10),site_id) u; # Time: 130527 7:41:25 # User@Host: commons[commons] @ localhost [] # Query_time: 1.925550 Lock_time: 0.000098 Rows_sent: 1 Rows_examined: 745404 SET timestamp=1369654885; SELECT SUM(u.c) c FROM (SELECT COUNT(DISTINCT(ip)) c FROM `wp_184_firestats_hits` h,`wp_184_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user` = '0' AND `match_bots`='0' AND `site_id` = '1' AND 1 GROUP BY SUBSTRING(`timestamp`,1,10),site_id) u; # Time: 130527 7:41:28 # User@Host: commons[commons] @ localhost [] # Query_time: 1.117990 Lock_time: 0.000100 Rows_sent: 1 Rows_examined: 745407 SET timestamp=1369654888; SELECT SUM(u.c) c FROM (SELECT COUNT(DISTINCT(ip)) c FROM `wp_184_firestats_hits` h,`wp_184_firestats_useragents` u WHERE h.useragent_id=u.id AND `excluded_ip` = '0' AND `excluded_by_user` = '0' AND `excluded_user` = '0' AND `match_bots`='0' AND `site_id` = '1' AND 1 GROUP BY SUBSTRING(`timestamp`,1,10),site_id) u;
Updated by Boone Gorges over 11 years ago
- Status changed from Resolved to Assigned
- Assignee set to Boone Gorges
Thanks for posting this info, André.
I'd be surprised if those queries, annoying as they are, are alone responsible for bringing down the db. Seems like the overall influx of Firestats traffic is the real culprit.
I think that, as a short term solution, we might consider disabling the option to enable Firestats places where it's not already enabled. Maybe not a solution so much, but it will curb further issues. Matt, do you have any problems with this?
I can also look into Firestats to see if there's any way to cache some of this data for logged-out users. There's no reason why logged-out users have to see up-to-the-second exact visitor counts.
Updated by Matt Gold over 11 years ago
Matt, do you have any problems with this?
Nope -- I enthusiastically support that move.
Updated by local admin over 11 years ago
I think what happened was that the max number of connections was reached (500) then new connections (Sarah's) just failed silently.
Updated by local admin over 11 years ago
This picture tells the story (attached).
Also we've been having some bad guys (presumably) scanning the website over the last few days (from logwatch):
A total of 3 sites probed the server 50.56.58.47 50.57.190.97 50.57.68.14
Updated by Boone Gorges over 11 years ago
- Status changed from Assigned to Resolved
- Target version set to 1.4.29
Firestats is disabled for new users in https://github.com/castiron/cac/commit/cbca648b600151a7049815d4be8b8fcf9ddcb2f0
I looked into the code a bit to see what was going on. I can't find an obvious way to build in a throttle, without forking the plugin and rewriting much of the javascript. So I'm going to mark this Resolved for now, and we can address in greater depth if this turns out to be a recurring problem.