Avis aux amateurs, les 20Q sont à 1€ à Carrefour Portet !
5 commentaire(s)...
*** Disclaimer: this is not a howto, this is just my personal experience ***/etc/default/spamassassin to have only one process:
# NOTE: version 3.0.x has switched to a "preforking" model, so you # need to make sure --max-children is not set to anything higher than # 5, unless you know what you're doing. OPTIONS="--create-prefs --max-children 1 --helper-home-dir"Except this small detail, both RAM and disk usage are ok on my server.
top command at some times of the day can show very high load (>>10) with 100% CPU usage of course.
function getmicrotime()
{
list($usec,$sec)=explode(" ",microtime());
return ((float)$usec+(float)$sec);
}
$time_start=getmicrotime();
/* the ugly code here */
$time_end=getmicrotime();
$time=$time_end-$time_start;
printf('Page generated in %f seconds',$time);
So I often see in my footers that I host ugly slow code :)log-slow-queries option:
# Here you can see queries with especially long duration log-slow-queries = /var/log/mysql/mysql-slow.logWhen this option is present, all queries that take more than X seconds to complete are stored in the log file.
mysql_query() by a custom _mysql_query().mysql_query() builtin function, but I don't think I can do this with my PHP version.
function _mysql_query($string)
{
global $REMOTE_HOST;
/* global timer to store total time spent in SQL queries */
global $time_mysql;
/* start te timer */
$t1=getmicrotime();
/* do the query and save the result to return it to the caller */
$r=mysql_query($string);
/* stop the timer */
$t2=getmicrotime();
/* only show the trace for the developer */
if ($REMOTE_HOST=='my_computer_name')
print '<div class="mysql" title="'.$string.'">'.round(1000*($t2-$t1)).'</div>';
/* increase total SQL time */
$time_mysql+=$t2-$t1;
/* return the results to caller just like mysql_query would */
return $r;
}
/* ... */
$query = 'SELECT * FROM foo';
$result = mysql_query($query);
The time I am talking about here is "real" time, not CPU time spent on this specific process, so it is not very accurate, but still helpful.
function _trace($string)
{
global $REMOTE_HOST;
/* global timer started at the beginning of the page */
global $time_start;
/* total time spent in SQL queries */
global $time_mysql;
/* only show the trace for the developer */
if ($REMOTE_HOST=='my_computer_name')
print '<div class="php" title="'.$string.'">'.
round(1000*(getmicrotime()-$time_start-$time_mysql)).'</div>';
}
/* ... */
_trace('start big command');
very_slow_procedure();
_trace('stop big command');
Again, this allowed me to find very nasty things in my website.ab.
This is Apache HTTP server benchmarking tool, which allows to do many requests at a time on your server.ab -c 10 -n 100 http://google.com/For example this command will do 100 requests on http://google.com/, witch 10 requests in parallel.
apt-get install ia32-libs ia32-libs-gtk.dpgk --extract, puis on copie à l'arrache les bibliothèques dans le répertoire lib/ du jeu... et ça marche mieux :-)
















On continue dans la série des solutions anti-spam.
(même début...)
# try akismet database
include('akismet.php');
$akismet=new Akismet('http://zerezo.com/', 'ma_jolie_clef');
$akismet->setContent($spam_input);
if ($akismet->isSpam()) spam_log('akismet');
Et ça marche plutôt bien... depuis hier par exemple où j'ai mis à zéro mes statistiques de commentaires spam, j'ai filtré :