Fighting Server Overload
Published by Hanno Kaiser January 1st, 2007 in AdminComment spam is still threatening to shut down our servers. While the Akismet and Bad Behavior plugins keep most of the crap from showing up in the comments, the comment spam still makes it into the database and puts strain on the server. One problem with Askimet, in particular, is that it optimizes the comment tables on average after every 5th comment spam has been deleted. Here’s how the optimization, which causes most of our server load, can be delayed by patching the akismet.php file.
function akismet_delete_old() {
global $wpdb;
$now_gmt = current_time(’mysql’, 1);
$wpdb->query(”DELETE FROM $wpdb->comments WHERE DATE_SUB(’$now_gmt’, INTERVAL 15 DAY) > comment_date_gmt AND comment_approved = ’spam’”);
$n = mt_rand(1, 200); # This used to be $n = mt_rand(1, 5);
if ( $n == 100 ) # This used to be 5
$wpdb->query(”OPTIMIZE TABLE $wpdb->comments”);
}
As an additional anti-spam measure, we added an image plugin. It should work with or without cookies enabled. If you have difficulties posting or commenting, please send us an email.
Technorati Tags: spam
License
This work is published under a Creative Commons Attribution-Noncommercial 2.5 License.
One Response to “Fighting Server Overload”
Leave a Reply
Search
Categories
- Admin (10)
- Carpe Diem (1)
- Constructivism (4)
- Culture (38)
- Flusser (1)
- Hobbes (4)
- Jurisprudence (71)
- Kant (6)
- Law and Economics (16)
- Law and Society (91)
- Philosophy (53)
- Privacy (7)
- System Theory (6)
- Theories of Punishment (18)
- Uncategorized (17)
Posts by author
Hosted by SiteGround
Please let me know if the image plugin works.