Lesson Learned

We’ve got two packages running, OpenX and Phorum, that seem to make a lot of database connections. Sometimes so many that the whole database runs out of connections. Phorum gets hammered by bots looking to exploit vulnerabilities in the code (and sometimes finds them). OpenX is just greedy. Or needy.

So I got smart. I limited the database users that those tools connect as to just a handful of connections. Which solved one problem: we stopped getting errors complaining that there were too many users connected to the database. But we started finding that the site would slow to an absolute crawl from time to time.

Talking it through with a friend, he pointed out that what I was probably doing was causing all the rejected database connections to queue up and wait. Kind of not the ideal solution, though I bet I could further fine tune things to prevent that as well. A better idea, since the Phorum forums are entirely archival at this point, was to restrict any and all post requests in the directories where Phorum is running. In htaccess you’d say something like:

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(POST) [NC]
RewriteRule ^(.*)$ – [F]
</IfModule>

So that’s where I’ve left things for the moment. We’ll see how we fair.

PS. How much do I love that you can make a firefox search bar out of anything?

Leave a comment