![]() |
Thread view optimizations
This is a little hack that I did to improve the speed at which threads are
loading in my forums. I am experiencing very high server loads due to the limited hardware on the server and due to the high post counts in my forums. This hack has tremendously sped up showthread.php. In order to view an entire thread, showthread.php makes 3 queries into the post table. I have managed to divert one of these queries to the thread table, and have managed to combine the remaining 2 queries into a single query. The thread table is usually 10%-15% of the post table in terms of count, and it is about 5% of the post table in terms of its physical size. Using the thread table for one of the queries will definitely improve things. This hack requires no template or table changes. It is just 3 simple code changes made to the source code. |
looks nice :D will instlal
[high]* Hobbes clicks instlal when he finishes[/high] |
How about some benchmark statistics, by curiousity? ;)
What was the loading time before, and what is it now? (that is, if you have Teck's microstats installed) |
I'll install this...speed is good. :)
*mx3 clicks install |
I'd like to see some stats too :)
|
Loading a bit faster for me :)
|
Quote:
Perhaps someone with somewhat larger threads could post some stats.. |
Page generated in 0.61381495 seconds (81.33% PHP - 18.67% MySQL) with 25 queries.
Page generated in 0.41559005 seconds (80.16% PHP - 19.84% MySQL) with 24 queries. it loads fast i suppose. l8er sonic |
Always nice to drop a query when installing a mod instead of gain one..
Nice work :) |
So far its working nice. Why didnt vBulletin do this? Is there some sort of draw back?
|
Nice, easy to install and speeds up my pages a lot
*install* |
:bunny: wow! loads a lot faster, thx :)
clicking install.... |
Quote:
but you could use $forum['moderatenew'] to decide which version you wanted to use. if ($forum['moderatenew']) { //use old queries } else { //use faster queries } |
Installed without any problem. Threads load more faster!
Thanks Zzed! |
Same here :)!
|
Quote:
where to ? :ermm: |
My forums are private :)
|
Before: in 0.24841595
After: 0.20439696 |
Quote:
Why not just change this line... Code:
$postids.= "post.threadid='$threadid'"; Code:
$postids.= "post.threadid='$threadid' AND post.visible='1'"; |
BTW, this (after you've applied the mod)
Code:
$postscount=$DB_site->query_first("SELECT replycount AS posts FROM thread WHERE threadid='$threadid'"); Code:
$totalposts = $thread['replycount'] + 1; |
Quote:
this hack speeds thread-display because it will not have to crawl the whole post-table to check the "visible" column, it just uses the indexed "thread" column which is alot faster. this is not "a tiny bit" this is MUCH faster on big forums whith huge threads. I've installed it on my 2 million post forum and it runs like a charm now. |
Unfortunately I don't have a forum with 2 million posts to check it on. http://smilies.xibase.com/shrug.gif Why not index the visible column then? Since you have a multi-GB post table, what's an extra few dozen megs gonna hurt?
As for the post count, $thread['replycount'] is not incremented for posts that are placed in the moderation queue. it is only updated when they are taken out of the queue. That's the whole point of the reply count field, if there were more replies showing in the count on forumdisplay than were visible in the thread, people would start to wonder. |
I like this hack and it definately improved the speed, but we have a moderated users hack and this causes those posts to show up anyway, so I had to uninstall it.
Definately a great concept though :) |
Nice.. Thanks
|
fury's suggestion for reducing yet another query, has this been independently confirmed as well before I play with it. :D
|
Quote:
|
Can this optimization work with this hack below?
https://vborg.vbsupport.ru/showthrea...threadid=36416 These lines (that you ask me to replace) are different in my showthread.php: PHP Code:
PHP Code:
|
great hack, noticed it straight away
|
Any solution on my question above anyone? :)
|
Mow installed on AVS Forum (http://www.avsforum.com) and it does help with this large active site.
Anything to make the DB server happier. :) |
I installed this hack and it seemed to work OK.
Until.... you entered a forum and then clicked on a thread to view it. Then, an error was displayed. I had to upload the original file to correct it. I am using version 2.3.2 Anyone have any idea why this is not working for me? I am an extreme novice and feel silly even posting this. ********************* Edited to add: I have it working now. I was editing the file in dreamweaver. When I switched to notepad I was able to modify it and get it working. |
Wow, people are really sleeping the past few months...
Help! :D |
Ok I've decided to temporarily remove the other hack while I work it out. In the meantime I've installed this one, and the additional query removal from fury and all is working properly so far.. I'll let you know if it breaks anything. :D
Nice work you guys! |
Installed on vB 2.3.2.
Thanks :) |
Working fine ob vB 2.3.2.
/me clicks install. |
Works great on 2.3.2. Thanks!!
* zsmom clicks install. |
installed on 2.3.4 and working great! :D
|
All times are GMT. The time now is 02:45 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|