The DB server is MySQL 5, and is running on Gentoo 2006.1 with a 2.6.19.1 kernel, 16 opterons(yes, 16 cores), 32gb of RAM, and a fiberchannel attached disk array (so I can say for sure, it isn't a problem with "skimpy hardware").
The vBulletin is 3.6.3 with security patches up to 3.6.5.
Whenever the "Display Logged in Users?" option is turned on, the load on the database server (this behavior started only today) skyrockets from a comfortable 3-4 (it's normal load average) to upwards of 40-60, and mysql begins using 1500% cpu.
The queries which seem to be taking the longest:
EXPLAIN SELECT user.username, (user.options & 512) AS invisible, user.usergroupid, session.userid, session.inforum, session.lastactivity, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid FROM session AS session LEFT JOIN user AS user ON(user.userid = session.userid) WHERE session.lastactivity > 1175803046: *** row 1 *** table: session type: ALL possible_keys: lastactivity key: NULL key_len: NULL ref: NULL rows: 4220 Extra: Using where *** row 2 *** table: user type: eq_ref possible_keys: PRIMARY key: PRIMARY key_len: 4 ref: mdbb.session.userid rows: 1 Extra: NULL
mysql> describe session; +---------------+----------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+----------------------+------+-----+---------+-------+ | sessionhash | varchar(32) | NO | PRI | | | | userid | int(10) unsigned | NO | MUL | 0 | | | host | varchar(15) | NO | MUL | | | | useragent | varchar(100) | NO | | | | | lastactivity | int(10) unsigned | NO | MUL | 0 | | | location | varchar(255) | NO | | | | | styleid | smallint(5) unsigned | NO | | 0 | | | althash | varchar(32) | NO | | | | | badlocation | smallint(5) unsigned | NO | | 0 | | | inforum | smallint(5) unsigned | NO | | 0 | | | inthread | int(10) unsigned | NO | | 0 | | | incalendar | int(10) unsigned | NO | | 0 | | | loggedin | smallint(5) unsigned | NO | | 0 | | | idhash | varchar(32) | NO | MUL | | | | bypass | smallint(6) | NO | | 0 | | | languageid | smallint(5) unsigned | NO | | 0 | | | profileupdate | smallint(5) unsigned | NO | | 0 | | +---------------+----------------------+------+-----+---------+-------+ 17 rows in set (0.12 sec)
mysql> describe user; +--------------------+----------------------+------+-----+------------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------------+----------------------+------+-----+------------+----------------+ | userid | int(10) unsigned | NO | PRI | NULL | auto_increment | | usergroupid | smallint(5) unsigned | NO | MUL | 0 | | | username | varchar(100) | NO | MUL | | | | password | varchar(32) | NO | | | | | email | varchar(100) | NO | | | | | styleid | smallint(5) unsigned | NO | | 0 | | | parentemail | varchar(50) | NO | | | | | homepage | varchar(100) | NO | | | | | icq | varchar(20) | NO | | | | | aim | varchar(20) | NO | | | | | yahoo | varchar(32) | NO | | | | | usertitle | varchar(250) | NO | | | | | customtitle | smallint(6) | NO | | 0 | | | joindate | int(10) unsigned | NO | | 0 | | | daysprune | smallint(6) | NO | | 0 | | | lastvisit | int(10) unsigned | NO | | 0 | | | lastactivity | int(10) unsigned | NO | | 0 | | | lastpost | int(10) unsigned | NO | | 0 | | | posts | int(10) unsigned | NO | | 0 | | | timezoneoffset | varchar(4) | NO | | | | | pmpopup | smallint(6) | NO | | 0 | | | avatarid | smallint(6) | NO | | 0 | | | options | int(10) unsigned | NO | MUL | 0 | | | birthday | varchar(10) | NO | MUL | 0000-00-00 | | | maxposts | smallint(6) | NO | | -1 | | | startofweek | smallint(6) | NO | | 1 | | | ipaddress | varchar(15) | NO | MUL | | | | referrerid | int(10) unsigned | NO | | 0 | | | pmtotal | smallint(5) unsigned | NO | | 0 | | | pmunread | smallint(5) unsigned | NO | | 0 | | | passworddate | date | NO | MUL | 0000-00-00 | | | salt | char(3) | NO | | | | | showvbcode | smallint(5) unsigned | NO | | 0 | | | msn | varchar(100) | NO | | | | | avatarrevision | int(10) unsigned | NO | | 0 | | | membergroupids | varchar(250) | NO | | | | | displaygroupid | smallint(5) unsigned | NO | MUL | 0 | | | reputation | int(11) | NO | | 10 | | | reputationlevelid | int(10) unsigned | NO | MUL | 1 | | | languageid | smallint(5) unsigned | NO | MUL | 0 | | | threadedmode | smallint(5) unsigned | NO | | 0 | | | emailstamp | int(10) unsigned | NO | | 0 | | | autosubscribe | smallint(6) | NO | | -1 | | | birthday_search | date | NO | MUL | 0000-00-00 | | | profilepicrevision | int(10) unsigned | NO | | 0 | | | showbirthday | smallint(5) unsigned | NO | | 2 | | | skype | varchar(32) | NO | | | | | adminoptions | int(10) unsigned | NO | | 0 | | | lastpostid | int(10) unsigned | NO | | 0 | | | sigpicrevision | int(10) unsigned | NO | | 0 | | | ipoints | int(10) unsigned | NO | | 0 | | | infractions | int(10) unsigned | NO | | 0 | | | warnings | int(10) unsigned | NO | | 0 | | | infractiongroupids | varchar(255) | NO | | | | | infractiongroupid | smallint(5) unsigned | NO | MUL | 0 | | +--------------------+----------------------+------+-----+------------+----------------+ 55 rows in set (0.00 sec)
ANY help is appreciated, and this is a must-have feature, since we use this data for many reasons.
Thanks.
Comment