You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 162 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Advice to speed up Canadaka.net [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
canadaka
Corporal
Corporal


Joined: Aug 05, 2004
Posts: 71

Location: Vancouver, Canada

PostPosted: Tue Apr 18, 2006 11:40 pm Reply with quoteBack to top

Hello, i run the site called "Canada Kicks Rainbow Brite" www.canadaka.net
it is a fairly large site, usualy around 200 people on at any time, gets 6000 - 11,000 uique visitors a day.

But the site at many times seems rather slow, I think it could be much faster than it is, I had done a fair amount to try and improve speed, but I am looking for some advice on what more I could do. The main nuke site is not bad, the forums are the part that bug me with there slowness.

Here is my server setup, it my own rackserver, thats primary use is for this site, I do have around 30 other sites on it, but they are all pretty low visitor sites and low resource usage compared to Canadaka.net

About the Server

Dual Intel 2.4Ghz Xeon 533FSB
4 X 512MB DDR ECC (total 2GB)
Supermicro motherboard X5DLR-8G2+ and 1U rackcase
2 X 73GB U-320 SCSI 15,000 RPM Top of the line hard drives
Windows 2003 Web Server
IIS6 (gzip enabled)
PHP 5.0.3
MySQL 4.1.18-nt

The server is at a Peer1 Networks datacenter in Vancouver, BC Canada

----------------------------------------------

About the site
phpnuke 7.6
patched (which should have all the mainfile tweaks)
nukesentinel
bbtonuke 2.0.19
Cache_Lite (caching of most the blocks)
eaccelerator php caching (modified from the old nuke 'mmcache tweaks
http://www.karakas-online.de/forum/viewtopic.php?p=17536
most sections I only cache for guests, no caching for logged in users. forums are not cached at all. If i try to cache the forums the login system gets messed up and people get logged in as other users, A REAL NIGHTMARE!

Almost all the images on the site are fairly optimizes, down to the minium about of colours needed before they look like total Rainbow Brite.

Now as far as the forums go, I do have a lot of mods, I know they will add some slowdown, but my members and I really likethe mods. Plus given the specs of my server I feel the speed should be better.

So things I am looking for adive with:

Tweaks to phpnuke or phpbb code to optimize page, database queries
Settings for MySQL (right now they are all default install settings)
IIS Settings/tweaks) I do have a seperate applicaiton pool for this site.
tweaks to the php.ini
Other general speed improving advice.

I made a temp site account if you dont want to register, many of the forum features are disabled to guests, so the page loads faster, especialy for google bots.
Username: reviewer
password: cka

_________________
Canada Kicks Rainbow Brite! www.canadaka.net
Portfolio: www.trevormay.ca
Canadian Hotties www.canadianhottie.ca
Find all posts by canadakaView user's profileSend private messageVisit poster's website
canadaka
Corporal
Corporal


Joined: Aug 05, 2004
Posts: 71

Location: Vancouver, Canada

PostPosted: Fri Aug 11, 2006 6:55 pm Reply with quoteBack to top

wow.. these forums are pretty dead, heh

I am looking into ways to reduce the amount of db queries needed to load just a basic page, no module or blocks.

Here is an example, the content of this page is just html, after nukes header and footer. there is no blocks loaded

http://www.canadaka.net/modules.php?name=about&file=headers2

[ Script generation time: 0.1045s (PHP: 64% - SQL: 36%) ] - [ SQL queries: 34 ]

so my base nuke takes around 30 queries, any suggestions on how this could be lowered?
Find all posts by canadakaView user's profileSend private messageVisit poster's website
canadaka
Corporal
Corporal


Joined: Aug 05, 2004
Posts: 71

Location: Vancouver, Canada

PostPosted: Sun Aug 13, 2006 1:56 am Reply with quoteBack to top

saweet I got a basic pageload down to 9 db queries from 30+

example: http://www.canadaka.net/modules.php?name=about&file=headers2

tweaked some things in the theme.php and a couple other places, but where I lost most the queries was in the counter.php

If you don't need details statistic tracked, like hits per hour, day month, you can comment out a lot from includes/counter.php

I just left 2 DB queries there, for hits and year. I don't care about the rest, thats what server logs are for.

So there is a tip to reduce some db queries, counter.php


Last edited by canadaka on Wed Aug 23, 2006 5:28 pm; edited 1 time in total
Find all posts by canadakaView user's profileSend private messageVisit poster's website
spottedhog
Captain
Captain


Joined: Apr 30, 2004
Posts: 561


PostPosted: Sun Aug 13, 2006 4:01 am Reply with quoteBack to top

There are a couple of other areas to consider.......

Points.... not sure where that is now because I removed it long ago.

Survey block.... If you use the Nuke Survey module and block, those are pure db query hogs.

Seems like some very knowledgeable people have left here in the past 2 months. Not sure what has happened......

_________________
SMF-Nuke admin

SMF and PHP Nuke integration is ready! Take a look at it by clicking on the link above.
Find all posts by spottedhogView user's profileSend private messageSend e-mailVisit poster's website
webjunky
Lieutenant
Lieutenant


Joined: May 11, 2003
Posts: 167


PostPosted: Sun Aug 13, 2006 11:14 am Reply with quoteBack to top

USE THIS:

function is_admin($admin) {
global $prefix, $db;
if(!is_array($admin)) {
$admin = addslashes($admin);
$admin = base64_decode($admin);
$admin = explode(":", $admin);
$aid = "$admin[0]";
$pwd = "$admin[1]";
} else {
$aid = "$admin[0]";
$pwd = "$admin[1]";
}
if ($aid != "" AND $pwd != "") {
$aid = substr("$aid", 0,25);
$result = $db->sql_query("SELECT pwd FROM ".$prefix."_authors WHERE aid='$aid'");
$row = $db->sql_fetchrow($result);
$pass = $row['pwd'];
if($pass == $pwd && $pass != "") {
return 1;
}
}
return 0;
}

function is_user($user) {
global $db, $user_prefix;
if (isset($userSave)){ return $userSave;}
if (!is_array($user)) {
$user = base64_decode($user);
$user = explode(":", $user);
}
$uid = $user[0];
$pwd = $user[2];
$uid = intval($uid);
if ($uid != "" AND $pwd != "") {
$sql = "SELECT user_password FROM ".$user_prefix."_users WHERE user_id='$uid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$pass = $row['user_password'];
if ($pass == $pwd && $pass != "") {
static $userSave;
return $userSave = 1;
}
}
static $userSave;
return $userSave = 0;
}

IT SETS THE USER AND SO IT DOESN'T PERFORM THE CHECKS ALL THE TIME ON PASS

_________________
- Do not pm me for help -
Find all posts by webjunkyView user's profileSend private message
webjunky
Lieutenant
Lieutenant


Joined: May 11, 2003
Posts: 167


PostPosted: Sun Aug 13, 2006 11:15 am Reply with quoteBack to top

AND IF IT ISN'T ALLREADY THERE... ADD TO MAINFILE:

$phpver = phpversion();
if ($phpver >= '4.0.4pl1') {
ob_start('ob_gzhandler');
}else if ($phpver > '4.0'){
if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')){
if (extension_loaded('zlib')){
$do_gzip_compress = TRUE;
ob_start();
ob_implicit_flush(0);
}
}
}

_________________
- Do not pm me for help -
Find all posts by webjunkyView user's profileSend private message
canadaka
Corporal
Corporal


Joined: Aug 05, 2004
Posts: 71

Location: Vancouver, Canada

PostPosted: Wed Aug 23, 2006 5:27 pm Reply with quoteBack to top

spottedhog wrote:
There are a couple of other areas to consider.......

Points.... not sure where that is now because I removed it long ago.

Survey block.... If you use the Nuke Survey module and block, those are pure db query hogs.

Seems like some very knowledgeable people have left here in the past 2 months. Not sure what has happened......


I am using the points system, but not seriosuly, because there is a points leak somewhere, arg thats another issue, can't find it. some users get tons of points somehow.

But i dont have points for pageviews, only for posting things so i dont think any db queries lost there?

I don't use the survey block, do you mean even if i dont the core nuke has some queries relating to it?


Quote:

$phpver = phpversion();
if ($phpver >= '4.0.4pl1') {
ob_start('ob_gzhandler');
}else if ($phpver > '4.0'){
if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')){
if (extension_loaded('zlib')){
$do_gzip_compress = TRUE;
ob_start();
ob_implicit_flush(0);
}
}
}


do you mean to replace that with what I have currently? which is:

Code:

$phpver = phpversion();
if ($phpver < '4.1.0') {
    $_GET = $HTTP_GET_VARS;
    $_POST = $HTTP_POST_VARS;
    $_SERVER = $HTTP_SERVER_VARS;
}
if ($phpver >= '4.0.4pl1' && strstr($_SERVER["HTTP_USER_AGENT"],'compatible')) {
    if (extension_loaded('zlib')) {
   ob_end_clean();
   ob_start('ob_gzhandler');
    }
} else if ($phpver > '4.0') {
    if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) {
   if (extension_loaded('zlib')) {
       $do_gzip_compress = TRUE;
       ob_start(array('ob_gzhandler',5));
       ob_implicit_flush(0);
       header('Content-Encoding: gzip');
   }
    }
}[quote]


I changed the is_admin and is_user with yours but no change in # of queries.


Something I did do awhile ago that helped, though I would pass on. In my themes I have severl things that only show if_user, so rather than checking with that function multiple times, I check once in theme.php, then set a variable = TRUE, there. that I then use in my theme files. I do the same to check if a user is_paid.

I've been tweaking my block files. many had db queries inside query loops. Have reduced this by using Select joins.
[/quote]
Find all posts by canadakaView user's profileSend private messageVisit poster's website
bicho
Private
Private


Joined: Jun 14, 2005
Posts: 36


PostPosted: Sun Oct 08, 2006 9:06 pm Reply with quoteBack to top

Any more ways to get less queries??? I cant believe how slow a site can run with nuke. Even on my 3.2Ghz server with 2gigs of ram it runs like crap. Did you figure anything else out canadaka?
Find all posts by bichoView user's profileSend private message
spottedhog
Captain
Captain


Joined: Apr 30, 2004
Posts: 561


PostPosted: Mon Oct 09, 2006 4:23 am Reply with quoteBack to top

Here are some ways to make Nuke faster.....

--Make code XHTML Strict compliant.
--in Statistics, remove code that collects hourly and daily stats.
--drop the updatepoints from mainfile.php and modules that use it.
--use less graphic intensive themes
--do NOT use google adsense
--modify your robots.txt file to allow only specific search bots
--modify your .htaccess file to deny spam and referer harvesters
--drop the Survey block from loading

If you use Sentinel, it will also use a lot of overhead, checking each IP hit, etc.

This would be a good start.....

_________________
SMF-Nuke admin

SMF and PHP Nuke integration is ready! Take a look at it by clicking on the link above.
Find all posts by spottedhogView user's profileSend private messageSend e-mailVisit poster's website
canadaka
Corporal
Corporal


Joined: Aug 05, 2004
Posts: 71

Location: Vancouver, Canada

PostPosted: Fri Apr 20, 2007 7:38 pm Reply with quoteBack to top

Thansk for the comments spottedhob. I had already done msot of what you suggested long ago.

My layout is not XHTML Strict compliant though, I guess I could make it so, but would that really have an affect on speed?

I would love to disable nukeSentinel, i know it usesa lot of overhead. But I am afraid to do so, Sentinel blocks 10-20 ips/attacks? a day on my site.

Hmm doing some testing, removing the include of nukesentinel only saves 9 db queries... i guess thats a fair bit when you add it up. But I you don't notice any decrease in page load times.
http://www.canadaka.net/test.php
Find all posts by canadakaView user's profileSend private messageVisit poster's website
Evaders99
Site Admin
Site Admin


Joined: Aug 17, 2003
Posts: 12482


PostPosted: Fri Apr 20, 2007 10:55 pm Reply with quoteBack to top

I don't know what else you could really do. Perhaps switching to an Apache server?

Speed seems just fine for me, most page generation is under 1 sec.

_________________
Helping those that help themselves
Read FIRST or DIE!

"Fighting is terrible, but not as terrible as losing the will to fight."
Star Wars Rebellion Network - Need Help? Evaders Squadron Coding
Find all posts by Evaders99View user's profileSend private messageVisit poster's websiteAIM Address
canadaka
Corporal
Corporal


Joined: Aug 05, 2004
Posts: 71

Location: Vancouver, Canada

PostPosted: Fri Apr 20, 2007 11:35 pm Reply with quoteBack to top

Most of the nuke module pages load fast, and the front-page along with some other key pages are cached (I manualy output the contents to an html file), so they load fast. Its really the /forums where the problem is.

During the day the forum index takes 5-15 seconds to load, and I'm even caching a bunch of the output at the bottom of the forum index (blogs, recent users). Forum Topic pages take 5-10+ seconds to load.

And when the site gets bogged down, it gets ever slower. But if its high traffic i think it becomes more of a server hardware issue. And for those times I am getting a 2nd server to use as a dedicated MySQL box.


*TIP*
For guest users I cache the entire /index.php to a static html file. I added some code to the start of index.php and end of footer.php to catch the output and write it to an html file. Then I load this file if its less than 2min old. It makes a HUGE difference. Id recommend anyone with a heavy front-page to do something simular.

[hr]

index.php (at the top)
Code:

//Canadaka's homepage full page cache
$cookie_username = $HTTP_COOKIE_VARS["phpnukeUser"];
if ($cookie_username == null and $user == null) {
   $cachefile_home = 'D:/Hosted Sites/canadaka.net/www/cache/home.html';
   $cachetime_home = 1 * 60;
   if (file_exists($cachefile_home) && time() - $cachetime_home < filemtime($cachefile_home)) {
      echo "<!-- Cached Home, generated ".date('H:i', filemtime($cachefile_home))." -->\n";
      include($cachefile_home);
      $cached_home = 1;
      die();
   }
   
   if ($cached_home != 1) {
      ob_start();
   }
}


footer.php (to very bottom)
Code:

//Canadaka's homepage full page cache
if ($cached_home != 1 and $cookie_username == null) {
   $fp = fopen($cachefile_home, 'w');
   fwrite($fp, ob_get_contents());
   fclose($fp);
   ob_end_flush();
}
die();

make sure you remove any die(); in footer.php above this point.

I imagine there might be a better way to do this, but it works for me.
Find all posts by canadakaView user's profileSend private messageVisit poster's website
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.049 Seconds - 312 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::