![]() |
Let us know what you think ...
Replace the makeforumjump section in global.php with this hold your breath and pray ! (it joins 2 sql queries into one - we've got it running on forums.gameplay.com ;-) ) also downloadable from http://forums.gameplay.com/global_hack_pt1.html (err yes there is at least another one on it's way ...) fodder // ###################### Start makeforumjump ####################### function makeforumjump () { // this generates the jump to box global $DB_site, $forumid, $optionselected, $usecategories, $jumpforumid, $jumpforumtitle, $jumpforumbits, $curforumid; global $hideprivateforums, $defaultselected, $forumjump, $bbuserid, $bbusergroupid; if ($forumid != "") { $curforumid = $forumid; } else { if ($threadid != "") { $getforumid = $DB_site->query_first ("SELECT forumid FROM thread WHERE threadid=$threadid"); $curforumid = $getforumid["forumid"]; } } $categorys = $DB_site->query ("SELECT category.categoryid, category.title as ctitle, category.displayorder , forum.forumid, forum.title as ftitle, forum.displayorder FROM category,forum WHERE forum.categoryid=category.categoryid AND forum.displayorder <>0 and category.displayorder<>0 and forum.active=1 order by category.displayorder, forum.displayorder"); $this_cat=0; $old_categoryid=0; $old_ctitle=""; while ($category = $DB_site->fetch_array ($categorys)) { $forum=$category; if ( $this_cat != $category["categoryid"] ) { if ($this_cat >0) { if ($usecategories == 1 and $forumshown == 1) { $jumpforumid = ""; $jumpforumtitle = ""; eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); if ($curforumid == "cat$old_categoryid") { $optionselected = "selected"; } $jumpforumid = "cat$old_categoryid"; $jumpforumtitle = "Category: $old_ctitle"; eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); $optionselected = ""; $jumpforumid = ""; $jumpforumtitle = "--------------------"; eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); } // add forum bits $jumpforumbits.= $tempjumpforumbits; } $optionselected = ""; $forumshown = 0; $tempjumpforumbits = ""; $this_cat = $category["categoryid"]; $old_categoryid = $this_cat; $old_ctitle=$category["ctitle"]; } if ($hideprivateforums == 1) { $getperms = getpermissions ($bbuserid, $bbusergroupid, $forum["forumid"]); } else { $getperms["canview"] = 1; } if ($getperms["canview"] == 1) { $forumshown = 1; $jumpforumid = $forum["forumid"]; $jumpforumtitle = " " . $forum["ftitle"]; else { $optionselected = ""; } eval ("\$tempjumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); } // end if $getperms... } if ($usecategories == 1 and $forumshown == 1) { $jumpforumid = ""; $jumpforumtitle = ""; eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); //if ($curforumid == "cat".$category["categoryid"]) if ($curforumid == "cat$old_categoryid") { $optionselected = "selected"; } // $jumpforumid = "cat" . $category["categoryid"]; $jumpforumid = "cat$old_categoryid"; // $jumpforumtitle = "Category: " . $category["ctitle"]; $jumpforumtitle = "Category: $old_ctitle"; eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); $optionselected = ""; $jumpforumid = ""; $jumpforumtitle = "--------------------"; eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); } // add forum bits $jumpforumbits.= $tempjumpforumbits; if ($selectedone != 1) { $defaultselected = "selected"; } eval ("\$forumjump = \"".gettemplate ("forumjump")."\";"); } if ($curforumid == $jumpforumid) { $optionselected = "selected"; $selectedone = 1; } |
fodder has this hack and the showthread hack helped your forum speed?
|
Seems to.
The main thrill about is is that it reduces the load on the database server. We have about 1.1 million posts these days so anything that makes our db server's life easier is very welcome ! in summary what it does is compress the category select in with the forum select so that you are only doing one sql query rather than 1+ number of forums in your db .. It helps a bit The next hack ( coming in about 10 mins ) also does help the db loading. If you want to see the difference tell mysql to do logging tail the log and compare the two. The next hack makes that test look very very very very scary indeed :) fodder |
There are a couple errors in your code involving extra and missing brackets so I wonder how you are running it. Here is a "fixed" version as in it seems to work
Code:
// ###################### Start makeforumjump ####################### |
which bits did you change ?
my eyes are going ! it might have been the cut and paste is the web page one better ? fodder |
Also what is the point of this code which comes at the end of the function, is not returned from the function and occurs after all templates are set. I can see it hopes to set the combobox to display the current forum but has little hope of working coming after the template. This code needs to be checked over closely before being installed. IMHO
Code:
if ($curforumid == $jumpforumid) |
I gave up waiting on your web page version to load but I just looked at it and it is different than your pasted one!
Quote:
|
It might be my eyes but I think that that comes just before
an eval statement ...? Fodder |
Look at the end of the code you pasted - it comes after the eval and also notice you don't close the function off with a }
|
Like I said the cut and paste may have gone wrong
Try the downloadable version from the URL given http://forums.gameplay.com/global_hack_pt1.html That has a greater chance of being right ... Fodder |
What is the next hack?
This hack looks promising. Is it bug free? |
Well I think it's bug free B-) but ... :)
The other hack is in the thread titled "[release] hack pt 2 for global.php - makes the smilie look up " Have a read of it and let us know there !!! It makes your db's life easier as well Fodder |
Fodder Question:
What does your system run on? What are your servers specs and OS? I just bought a server. It has: Dual PIII 850's 1.5 GB of RAM 5 Ultra 2 36.4 GB Hard Drives Raid 5 Using Slackware Are you using MySQL as your DB. I spoke to a user thatported VB for Sybase. They said it was fast. See I am having some problems runing my MySQL DB on my curretn server of: Dual PIII 450's 712 MB of Ram 2 Ultra 2 36.4 Hard Drives Running FreeBSD The MySQL load jumps tremendously. Can you post your MySQL variables and settings. I would be very grateful. Thanks for your time. :) |
When it's going fast i'll let you know !
Seriously though I suggest this ... If you have put in my index additions ( only do this if you have alot of RAM and a big forum) then you need to set your key buffer to be about 10MB bigger than the total file size of your *MYI files ( yes these are mine :) ) 390800568 Sep 7 09:40 post.MYD 63578112 Sep 7 09:40 post.MYI 8930 Aug 23 15:10 post.frm Make sure you have enough RAM to hold the whole of your files in ram plus your max_connections * all the memory used per thread. check your sort buffer, join buffer etc That should then hopefully make it go faster ! Also try both of my hacks - this one and http://forums.gameplay.com/global_hack_pt2.html will make your db machine happier in peak load try watching /usr/bin/vmstat 1 This will let you know if you are swapping like mad. Also watch top to see whats going on ! Your new machine will help ! Donate the old one to being a web server :) Oh and yes i'm using MySQL. Fodder |
Where can I find them?
|
This is (i think) my latest version of the database - i'll update it if not
http://forums.gameplay.com/my_forums_database_def.html Have a look at it and see how it compares to you ( do mysqldump -d <insert name of forum db here) This will dump you out a similar listing ... Where i've got a key that you havn't you need to do something like mysql> alter table <table> add index <column name> (<column name>) If you have ones that I don't post 'em here however if they are the two in one things then you need to remove them as MySQL can't use them all the time ... mysql> alter table <table> drop index <index name> Fodder |
Here is mysql dump for my DB
Please tell me what you think? How do I make the changes in phpMyAdmin to your indexes? Code:
# MySQL dump 6.0 |
Hey not bad :)
I think you've got nearly them all ! I don't know how you add indexes in PHPAdmin being more of a 'hands on' type person :) Try the command line version if you can otherwise can someone else help that knows PHPAdmin ? Sorry Fodder |
All times are GMT. The time now is 08:38 PM. |
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:
|