Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Optimizing Forumhome Details »»
Optimizing Forumhome
Version: 1.00, by Xenon Xenon is offline
Developer Last Online: Oct 2023 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 12-19-2002 Last Update: Never Installs: 94
 
No support by the author.

Ok, what this Hack does is it reduces the ammount of queries on forumhome by caching the moderatorlist and by optimizing most of the queries used on index.php


I'd really appreciate getting feedback how it reduces serverload on greater boards

On an unhacked vb index.php (pm enabled accesmask disabled) it reduces the ammount of queries from 19 to 15
my experiments have shown, that the queries are faster than the normal ones, too....

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #142  
Old 01-25-2003, 11:52 AM
squawell's Avatar
squawell squawell is offline
 
Join Date: Oct 2001
Posts: 681
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Xenon
@Squawell: hmm, couldn't be normally the login/out feature are not touched by my hack.
Also it works perfect for all.
maybe you've changed the index on a piece of code where you shouldn't..

collidation with another hack you've installed propably?
in fact...it not just effect the login function.. when i add or edit the new forum the main page also didnt show up too(the change part).....so strange...it only happen to userid=1 user.....i try another user account its normal and work perfect.....so that make me confuse what cause that??

by the way i dont change anything in index.php i use the original index.php......
Reply With Quote
  #143  
Old 01-25-2003, 12:05 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

maybe your cookie is corrupted.
i know it can't happen because the part of code is not affected by my hack, at least not if you've done everything correct.

the last thing is normal, whenever you add or edit a forum on forumhome or add a moderator or something like that, it will just change after the cache has been updated, so whenever one new post has been made.
Reply With Quote
  #144  
Old 01-25-2003, 01:03 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I had a problem with this hack, when we were editing some templates for forumhome, they weren't updating on forumhome, so you can't see the changes, and when someone could see the changes, someone else couldn't...all in all I couldn't risk any problems and I just uninstalled the caching part of the hack..
Reply With Quote
  #145  
Old 01-25-2003, 04:42 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@N9ne: It's not a problem.
all you have to do after editing a template on forumhome is to make a new post and then all caches would be updatet...

you could also edit templates.php to manually delete all cached versions whenever you make a templateedit.

As said, it's not a problem, it's just how caching works without to rewrite hundreds of files
Reply With Quote
  #146  
Old 02-02-2003, 02:50 PM
pwr_sneak pwr_sneak is offline
 
Join Date: Oct 2001
Location: Germany
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i just read your instructions to see if this hack would work for my forum.
but this query is much slower then the original ones:
PHP Code:
SELECT COUNT(*) AS messages,
SUM(IF(dateline>$bbuserinfo[lastvisit] AND folderid=0,1,0)) AS newpm,
SUM(IF(messageread=AND folderid=0,1,0)) AS unreadpm
FROM privatemessage WHERE userid
=$bbuserinfo[userid$ignoreusers 
you replaced three fast queries which reads the values from index by one slow query which crawls through the whole datafile. i did a quick test on my privatemessage table (1.2M messages), your query took 2.2 seconds to complete, the original ones took 0.2 seconds all together

but the rest of this cache looks good
Reply With Quote
  #147  
Old 02-02-2003, 03:38 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there any way to make the one query faster?
Reply With Quote
  #148  
Old 02-02-2003, 04:00 PM
pwr_sneak pwr_sneak is offline
 
Join Date: Oct 2001
Location: Germany
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've updated my last post due to an cut'n'paste error...

Quote:
Originally posted by Boofo
Is there any way to make the one query faster?
you have to run the original 3 queries to make it faster.
it's a good idea trying to decrease the number of queries, but it won't help anything if you replace some small and fast queries with one big and slow query.
Reply With Quote
  #149  
Old 02-02-2003, 04:23 PM
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
Posts: 469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by pwr_sneak
I've updated my last post due to an cut'n'paste error...


you have to run the original 3 queries to make it faster.
it's a good idea trying to decrease the number of queries, but it won't help anything if you replace some small and fast queries with one big and slow query.
Read this thread
https://vborg.vbsupport.ru/showthrea...threadid=38471
Also read this post made by Chen
https://vborg.vbsupport.ru/showthrea...638#post254638
Also read Matt's post <- This guy is a db Master BTW.
https://vborg.vbsupport.ru/showthrea...690#post254690
Reply With Quote
  #150  
Old 02-02-2003, 05:25 PM
pwr_sneak pwr_sneak is offline
 
Join Date: Oct 2001
Location: Germany
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by nuno

Read this thread
https://vborg.vbsupport.ru/showthrea...threadid=38471
Also read this post made by Chen
https://vborg.vbsupport.ru/showthrea...638#post254638
Also read Matt's post <- This guy is a db Master BTW.
https://vborg.vbsupport.ru/showthrea...690#post254690
Matt runs Sybase instead of MySQL, you can't compare this.
MySQL optimizes count(*) queries because it keeps an extra counter in its index-files when using MyISAM Tables. The Index should be read from RAM on heavy-used tables. This kind of queries as well as MAX(indexed-column) can be answered without I/O which makes it really fast.

this sum(...,1,0) trick has to read every row from the table or just every entry in its index if its condition matches from index. so this is always slower than reading three single values with three single queries.
Reply With Quote
  #151  
Old 02-02-2003, 05:42 PM
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
Posts: 469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by pwr_sneak

Matt runs Sybase instead of MySQL, you can't compare this.
MySQL optimizes count(*) queries because it keeps an extra counter in its index-files when using MyISAM Tables. The Index should be read from RAM on heavy-used tables. This kind of queries as well as MAX(indexed-column) can be answered without I/O which makes it really fast.

this sum(...,1,0) trick has to read every row from the table or just every entry in its index if its condition matches from index. so this is always slower than reading three single values with three single queries.
Quote:
Originally posted by FireFly
I did that Matt.

PHP Code:
  $allpm=$DB_site->query_first("SELECT COUNT(*) AS messages,
                                SUM(IF(dateline>
$bbuserinfo[lastvisit] AND folderid=0,1,0)) AS newpm,
                                SUM(IF(messageread=0 AND folderid=0,1,0)) AS unreadpm
                                FROM privatemessage WHERE userid=
$bbuserinfo[userid] $ignoreusers");

  
$newpm['messages']=$allpm['newpm'];
  
$unreadpm['messages']=$allpm['unreadpm']; 
Well I copied it from somewhere, don't really remember right now. But the problem is the query is slower for users with lots and lots of PM's (like myself), but considering most people don't I thought it would be wiser to just use that one query.
Chen already said one query is slower, however, this only occurs when you have a considerable amount of PM's stored.
So, i think your assumption is not correct.
It is faster for users with few pm's.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:03 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06632 seconds
  • Memory Usage 2,328KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete