One more time my Site is creating too much load on mysql server, and this probably because of SEF404.

(SEF) Allows Search Engine Friendly URLS for apache and IIS, returns proper 404 status code for missing content, provides logging of 404 errors, and creation of special "shortcut" URLs that allow the user to redirection to the new URL.

My ranking will probably go down for a while, since in 2 weeks my url are constantly changing on my homepage. In between I have installed OpenSEF

OpenSEF is an open source advanced SEF component for Joomla!/Mambo/OSM which enables automatic and manual text-based search engine friendly URLs for core and 3rd-party components. One goal of the OpenSEF project is to create relationships with many 3rd-party component developers to ensure that OpenSEF works immediately and flawlessly with all components.

I've patched Joomla kernel to display some interesting information in one log file on server: because Joomla normaly output only sql statement in user browser.

The file contains all queries executed per user

user has executed  82 queries
queryId    dateAndTime   queryExecution   sqlQuery
...
...

the code is below in click read more

  1. create a file logger.php and place it under the root of Joomla

 

defined( '_VALID_MOS' );

/** a small hack to display all queries executed by joomla per page
* @authors Walter Cedric
*/
if ($mosConfig_debug) {

if ( !function_exists('fopen') ||
!function_exists('fclose') ||
!function_exists('fwrite') )
return;

$file = fopen($mosConfig_absolute_path.'/sqllogs.txt', 'a');
if(!$file){
die("File failed to open");
} else{

$msg = $databas-->_ticker . " queries executed for user\n";
foreach ($database->_log as $k=>$sql) {
$msg .= $k+1 . " " . $sql."\n";
}

$status = fwrite($file, $msg);
fclose($file);
if(!$status){
die("sqllog write failed...");
}

}
}

?>

2. open index.php and replace
// displays queries performed for page
if ($mosConfig_debug) {
 echo $database->_ticker . ' queries executed';
 echo '<pre>';
  foreach ($database->_log as $k=>$sql) {
   echo $k+1 . "\n" . $sql . '<hr />';
 }
}
by
//add by www.waltercedric.com
include($mosConfig_absolute_path.'/logger.php');
3. Open /includes/database.php and replace line 261 what's in boldglobal $mosConfig_debug;
  if ($this->_limit > 0 || $this->_offset > 0) {
   $this->_sql .= "\nLIMIT $this->_offset, $this->_limit";
  }
  $this->_errorNum = 0;
  $this->_errorMsg = '';
  if ($this->_debug) {
   $this->_ticker++;
     $this->_log[] = $this->_sql;
  }  
  $this->_cursor = mysql_query( $this->_sql, $this->_resource );
by:
//add by waltercedric.com
  if ($this->_debug) {
     $start = microtime();
  }

  $this->_cursor = mysql_query( $this->_sql, $this->_resource );  
  if ($this->_debug) {
   $this->_ticker++;
     $this->_log[] = "".date('Y.m.d H:i:s')." ".round(microtime()-$start, 4)." '".str_replace("\n", " ", $this->_sql);
  }
4. Create a file
sqllogs.txt under Joomla root and chmod to 666
5. To start logging, open configuration.php 
and set $mosConfig_debug = '0'; to $mosConfig_debug = '1';

Quick and dirty, but it is late 23:00 PM and I still have to go for dinner...next time I will do it better:

  • export a CSV file, rotating logs, and so on....

 

 
comments powered by Disqus

You might like also

No Thumbnail was found
Joomla! Joomla! Extensions Showcase Joomla! Extension Forums Joomla! Extension Tickets Joomla! unnoficial mirror Joomla! WIKI Documentation WEB 2.0 Nas-at-home costs storage calculations Display structure of website based on their HTML tags Browse my sites using tags Browse my sites using mind map trees My CSS Sprite Generator online Scrum Planning Poker Timer Fun My name will land on Planet Mars! My name will orbit around Planet Pluto "Send Your Name to the Moon" Project Face in Space project Message to Bennu …
1548 Days ago
Merry Christmas to all my friends and visitors all around the world!
I would like to wish everyone a Merry Christmas / Joyeux Noel / Frohliche Weihnachten! …
1972 Days ago
No Thumbnail was found
Sometimes it is good to Google for your name, sometimes some funny stuff popup… www.waltercedric.com ranks 69382 out of 256 million domains on the web and has a Google PageRank of "7" . "utf-8 character encoding is being used on www.waltercedric.com and its textual language contains English and it is located in Germany, www.waltercedric.com is being sponsored by advertising networks such as google adsense, with an estimated monthly earnings of $1440 and an estimated worth of $5’809’581 with 852569 visitors …
2907 Days ago
My Bug tracking tool is now open to anonymous users
You do not have to register anymore to view issues and all my projects (all Google bots are now welcomed to crawl the site) But In order to better track issues, I still recommend you to create an account as soon as you want to ask or do something serious. Google will rapidly index the site and hopefully also all comments and workaround I will publish there. Please Do not hesitate to post any new features on every component wish …
3498 Days ago
Social ranking: a new way to estimate the social value of your site
Social ranking is crucial because it can be thought of as a measurement of your influence as far as social networks go. I found a site while Googling that try to measure this social value. it is always good to know where you are, and how you compare to others. &160; &160; &160; &160; BuildStats will provide you with free site information for your or a competitors' site, using multiple resources. The site information will highlight on page and off …
3528 Days ago
My résumé is up to date
I just update my résumé …
3582 Days ago
Showcase Joomla! site is up to date
You can see all my new extensions live running at http://demo2.waltercedric.com NOW …
3627 Days ago
I own cedric.walter on facebook
&160; I just reserve the name cedric.walter on facebook so starting from now, my profile can be reach at http://www.facebook.com/cedric.walter …
3628 Days ago
Pluton, Moon and firefox online
Don’t try to search any relationship with the 3 above words, I just found these files on my hard disk during a cleaning session and thought it may be good to put them online    http://pluton.waltercedric.com http://moon.waltercedric.com http://firefox.waltercedric.com …
3629 Days ago
Forums update to …… PHBB3
I decide to migrate to PHBB and went away from SMF! Don’t understand it wrongly, SMF was great for me in the last 3 years: stable, easy to use and not much targeted by hackers ;-) &160; &160; I leave SMF mainly as: There is no bridge available in Joomla! (bridge is discontinued and considered unsafe) I would like to unify login across all my sub domains in the near future. The idea is to let you log yourself only …
3703 Days ago