Reduce CPU Charge On Server With Rewrite


Subject: Reduce CPU Charge On Server With Rewrite
the rewrite spents a lot of cpu usage with this steps

you can do the rewrite only for bots

Code: [Download] [Hide] [Select]
#
#-----[ OPEN ]------------------------------------------
#

includes/page_header.php

#
#-----[ FIND ]------------------------------------------
#

function rewrite_urls($content)
{
global $config_mg;

function if_query($amp)

#
#-----[ REPLACE, WITH ]------------------------------------------
#
function rewrite_urls($content)
{
global $config_mg;
if((eregi("bot", getenv("HTTP_USER_AGENT"))) or (ereg("Google", getenv("HTTP_USER_AGENT"))) or (ereg("Slurp", getenv("HTTP_USER_AGENT"))) or (ereg("Scooter", getenv("HTTP_USER_AGENT"))) or (eregi("Spider", getenv("HTTP_USER_AGENT"))) or (eregi("Infoseek", getenv("HTTP_USER_AGENT"))))
{

//
// Begin keyword urls mod
//

function if_query($amp)


#
#-----[ FIND ]------------------------------------------
#

if ( isset($config_mg['url_rw']) && ($config_mg['url_rw'] === '1') )
{
$content = preg_replace($url_in, $url_out, $content);
}

return $content;

#
#-----[ REPLACE, WITH ]------------------------------------------
#
if ( isset($config_mg['url_rw']) && ($config_mg['url_rw'] === '1') )
{
$content = preg_replace($url_in, $url_out, $content);
}
}
return $content;



#
#-----[ OPEN ]------------------------------------------
#

includes/page_tail.php

#
#-----[ FIND ]------------------------------------------
#
// begin keyword urls mod
//

if( function_exists(ob_gzhandler) && $board_config['gzip_compress'] == 1)
{
$gzip_contents = rewrite_urls(ob_get_contents());
ob_end_clean();
ob_start('ob_gzhandler');
echo $gzip_contents;
ob_end_flush();
}
else
{
$contents = rewrite_urls(ob_get_contents());
ob_end_clean();
echo $contents;
global $dbg_starttime;
}

//
// end keyword urls mod
//
#
#-----[ REPLACE, WITH ]------------------------------------------
#
if((eregi("bot", getenv("HTTP_USER_AGENT"))) or (ereg("Google", getenv("HTTP_USER_AGENT"))) or (ereg("Slurp", getenv("HTTP_USER_AGENT"))) or (ereg("Scooter", getenv("HTTP_USER_AGENT"))) or (eregi("Spider", getenv("HTTP_USER_AGENT"))) or (eregi("Infoseek", getenv("HTTP_USER_AGENT"))))
{
// begin keyword urls mod
//

if( function_exists(ob_gzhandler) && $board_config['gzip_compress'] == 1)
{
$gzip_contents = rewrite_urls(ob_get_contents());
ob_end_clean();
ob_start('ob_gzhandler');
echo $gzip_contents;
ob_end_flush();
}
else
{
$contents = rewrite_urls(ob_get_contents());
ob_end_clean();
echo $contents;
global $dbg_starttime;
}

//
// end keyword urls mod
//
}

Subject: Respuesta: reduce cpu charge on server with rewrite
GREAT!!!!!

he, he!!! You're the #1!!!

Thanks!!

Subject: Re: reduce cpu charge on server with rewrite
another optimizations

gzip DISABLED----------------- :mrorange: this reduce cpu usage, and do all faster
and cache blocks

Subject: Re: Reduce CPU Charge On Server With Rewrite
He he he... great suggestion. :wink:

Subject: Re: Reduce CPU Charge On Server With Rewrite
It does make a difference :mrblue:

nice onecasimedicos,

Subject: Re: Reduce Cpu Charge On Server With Rewrite
casimedicos wrote: [View Post]
another optimizations

gzip DISABLED


where is?

Profile PM  
Subject: Re: Reduce CPU Charge On Server With Rewrite
ACP -> Board Settings


Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Generation Time: 0.1209s (PHP: 15% SQL: 85%)
SQL queries: 10 - Debug Off - GZIP Enabled