Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
long selects
Hello all!
As some of you know, ive had some problems with my forum lately, but I've got it mostly figured out. All my wierd errors were resultant of my server guy accidentally following the upgrade instructions from 1.1.x to 1.1.2 rather than from 1.0.3. oops! Everything is pretty much back to normal now, though, thank god.
However, my forum is running VERY slowly. We did some digging and this is what we found. I appologize if some of this is poorly worded or confusing, I'm a bit in over my head with database stuff but here goes...
Apparently theres a lot of what my server guy (hence forth referred to as Joshua) calls "long selects" going on. Here is an example query he showed me...
select m.CommentID as CommentID, m.DiscussionID as DiscussionID, m.Body as Body, m.FormatType as FormatType, m.DateCreated as DateCreated, m.DateEdited as DateEdited, m.DateDeleted as DateDeleted, m.Deleted as Deleted, m.AuthUserID as AuthUserID, m.EditUserID as EditUserID, m.DeleteUserID as DeleteUserID, m.WhisperUserID as WhisperUserID, m.RemoteIp as RemoteIp, a.Name as AuthUsername, a.Icon as AuthIcon, r.Name as AuthRole, r.RoleID as AuthRoleID, r.Description as AuthRoleDesc, r.Icon as AuthRoleIcon, r.PERMISSION_HTML_ALLOWED as AuthCanPostHtml, e.Name as EditUsername, d.Name as DeleteUsername, t.WhisperUserID as DiscussionWhisperUserID, w.Name as WhisperUsername, a.Preferences as AuthUserPrefs from LUM_Comment m inner join LUM_User a on m.AuthUserID = a.UserID left join LUM_Role r on a.RoleID = r.RoleID left join LUM_User e on m.EditUserID = e.UserID left join LUM_User d on m.DeleteUserID = d.UserID inner join LUM_Discussion t on m.DiscussionID = t.DiscussionID left join LUM_User w on m.WhisperUserID = w.UserID left join LUM_CategoryRoleBlock crb on t.CategoryID = crb.CategoryID and crb.RoleID = 3 where (crb.Blocked = '0' or crb.Blocked = 0 or crb.Blocked is null ) and (m.Deleted = '0' or m.Deleted = 0 ) and (m.WhisperUserID = '88' or m.WhisperUserID is null or m.WhisperUserID = 0 or m.WhisperUserID = '0' or m.AuthUserID = '88' ) and m.DiscussionID = '2645' order by m.DateCreated asc limit 6950, 50
This one apparently generates the index page of a particular thread, and its taking a long time to run. The problem is it joins a particular table (LUM_User) which gets written to a lot. I think it indicates something like the last time a user visited a page. The problem is that mysql locks the entire table behind the query that wants to write it. So if query "A" is very long and selects on LUM_User, and query "b" wants to write to LUM_User, too, it has to wait for A to finish. Meanwhile query "C" also wants to do a select with LUM_User, but cant because B, the update, still has it locked, so C has to wait for A to finish and... well you get the idea. We're seeing messages like this,
| 400 | sffixed | localhost | sffixed | Query | 0 | Locked |update LUM_User set DateLastActive=now() where UserID = '81' |
Which isn't good. So we're thinking theres either a problem with the schema, or queries, or an index isn't being used or something... We're not sure if enabling extensions would make much of a difference because it seems to be part of the core vanilla, which doesnt seemed to be coping well with high volumes. according to vanillazilla my board averages 337 posts a day, but i believe that accounts for the time when my board was getting off the ground, it believe its much higher now. not sure though.
What do you all think?
enabled extensions
AjaxQuote 1.0
Applicant Discovery 1.2
Audioscrobblerizer .2
bbinsertbar 0.1.5
better bb code 1.0
comment links 1.1
confirm go back .1
discussion filters 2.0
discussion view count 1.2.1
extended text formatter 1.2
flickr feed 1.0
hide success 1.0
html formatter 2.0.5
IP History 1.0.1
Markallread 1.0
new applicants 1.3
next unread discussions 1.0
page manager 2.4.3
preview post 2.4
quick keys 1.0
short stat 1.3
sidepanel 1.0
signatures 1.0.1
simplified discussions 1.0
spellchecker 1.1
text mode switch 2.0
user filters .9
vanillacons 1.3
vanillazilla 1.0.1
whisper notification .1
whos online 1.1
window links 1.0
yellowfade .1
As some of you know, ive had some problems with my forum lately, but I've got it mostly figured out. All my wierd errors were resultant of my server guy accidentally following the upgrade instructions from 1.1.x to 1.1.2 rather than from 1.0.3. oops! Everything is pretty much back to normal now, though, thank god.
However, my forum is running VERY slowly. We did some digging and this is what we found. I appologize if some of this is poorly worded or confusing, I'm a bit in over my head with database stuff but here goes...
Apparently theres a lot of what my server guy (hence forth referred to as Joshua) calls "long selects" going on. Here is an example query he showed me...
select m.CommentID as CommentID, m.DiscussionID as DiscussionID, m.Body as Body, m.FormatType as FormatType, m.DateCreated as DateCreated, m.DateEdited as DateEdited, m.DateDeleted as DateDeleted, m.Deleted as Deleted, m.AuthUserID as AuthUserID, m.EditUserID as EditUserID, m.DeleteUserID as DeleteUserID, m.WhisperUserID as WhisperUserID, m.RemoteIp as RemoteIp, a.Name as AuthUsername, a.Icon as AuthIcon, r.Name as AuthRole, r.RoleID as AuthRoleID, r.Description as AuthRoleDesc, r.Icon as AuthRoleIcon, r.PERMISSION_HTML_ALLOWED as AuthCanPostHtml, e.Name as EditUsername, d.Name as DeleteUsername, t.WhisperUserID as DiscussionWhisperUserID, w.Name as WhisperUsername, a.Preferences as AuthUserPrefs from LUM_Comment m inner join LUM_User a on m.AuthUserID = a.UserID left join LUM_Role r on a.RoleID = r.RoleID left join LUM_User e on m.EditUserID = e.UserID left join LUM_User d on m.DeleteUserID = d.UserID inner join LUM_Discussion t on m.DiscussionID = t.DiscussionID left join LUM_User w on m.WhisperUserID = w.UserID left join LUM_CategoryRoleBlock crb on t.CategoryID = crb.CategoryID and crb.RoleID = 3 where (crb.Blocked = '0' or crb.Blocked = 0 or crb.Blocked is null ) and (m.Deleted = '0' or m.Deleted = 0 ) and (m.WhisperUserID = '88' or m.WhisperUserID is null or m.WhisperUserID = 0 or m.WhisperUserID = '0' or m.AuthUserID = '88' ) and m.DiscussionID = '2645' order by m.DateCreated asc limit 6950, 50
This one apparently generates the index page of a particular thread, and its taking a long time to run. The problem is it joins a particular table (LUM_User) which gets written to a lot. I think it indicates something like the last time a user visited a page. The problem is that mysql locks the entire table behind the query that wants to write it. So if query "A" is very long and selects on LUM_User, and query "b" wants to write to LUM_User, too, it has to wait for A to finish. Meanwhile query "C" also wants to do a select with LUM_User, but cant because B, the update, still has it locked, so C has to wait for A to finish and... well you get the idea. We're seeing messages like this,
| 400 | sffixed | localhost | sffixed | Query | 0 | Locked |update LUM_User set DateLastActive=now() where UserID = '81' |
Which isn't good. So we're thinking theres either a problem with the schema, or queries, or an index isn't being used or something... We're not sure if enabling extensions would make much of a difference because it seems to be part of the core vanilla, which doesnt seemed to be coping well with high volumes. according to vanillazilla my board averages 337 posts a day, but i believe that accounts for the time when my board was getting off the ground, it believe its much higher now. not sure though.
What do you all think?
enabled extensions
AjaxQuote 1.0
Applicant Discovery 1.2
Audioscrobblerizer .2
bbinsertbar 0.1.5
better bb code 1.0
comment links 1.1
confirm go back .1
discussion filters 2.0
discussion view count 1.2.1
extended text formatter 1.2
flickr feed 1.0
hide success 1.0
html formatter 2.0.5
IP History 1.0.1
Markallread 1.0
new applicants 1.3
next unread discussions 1.0
page manager 2.4.3
preview post 2.4
quick keys 1.0
short stat 1.3
sidepanel 1.0
signatures 1.0.1
simplified discussions 1.0
spellchecker 1.1
text mode switch 2.0
user filters .9
vanillacons 1.3
vanillazilla 1.0.1
whisper notification .1
whos online 1.1
window links 1.0
yellowfade .1
0
This discussion has been closed.
Comments
Not sure about the locking issue...
I forgot to mention that this was not an issue with 1.0.3, its deffinately resulting from the upgrade to 1.1.2. I know there still may be something funky going on from my goofy upgrade but thats why im asking for help! heh.
select [SOME FIELDS] from LUM_Comment m inner join LUM_Discussion t on m.DiscussionID = t.DiscussionID left join LUM_CategoryRoleBlock crb on t.CategoryID = crb.CategoryID and crb.RoleID = 3 inner join LUM_User a on m.AuthUserID = a.UserID left join LUM_User e on m.EditUserID = e.UserID left join LUM_User d on m.DeleteUserID = d.UserID left join LUM_User w on m.WhisperUserID = w.UserID left join LUM_Role r on a.RoleID = r.RoleID
When joining to the user table, it is pulling information about the author, who has edited it, who has deleted it, and who whispered it. The latter three are left joins, and all of them join to the primary key of the table... That's a pretty straight forward query.
Does your database have any indexes on it?
I'd really like to get to the bottom of it - db optimization is something I'd love to work on - but not many people seem to know how to make mysql faster.
I'll get joshua in here as soon as I can.
we have a long discussion about this problem that may be of interest to you. it gets pretty technical, and there are several vanilla admins in there talking about things encountered while running our forums.