High spam mail traffic -> max mysql connections

I'm running into a problem and am looking for a good solution to fix this.
Eventually everybody running ispconfig3 will run into this problem!

After doing a clean Debian install and fresh ispconfig 3 installation (3.0.3.3)
i've added some domains, domains of which i know are attractive to send mail to.

The problem I'm running into is the MySQL connections.
All mails that get send to the server need a MySQL connection to check if it's black-,white-listed, filter rules, alias settings etc etc.

So what happens when your server gets hammered by spammers .. max MySQL connections .. and your sites will show blank pages, display MySQL errors etc .. I've set the max connections up to 250 now, and set the timeout for MySQL connections a lot lower (i think it was 120 or 180sec).
Doesn't work, I'm still running into max connections.

I'm using RBL (zen.spamhaus.org), but it looks like there are still connections being made, in a high tempo.

Please set max_connections and max_user_connections in mysql my.cnf file to 500 and restart mysqld. Setting just max_connections will not have an effect without setting higher max_user_connections as well. The recommended value that works fine on my systems is 500.

I will try 500, see how that goes, but still, maybe we should look for another way to prevent such an amount of connections being made to the MySQL server for checking some mail rules/filters. Since people will run websites on the servers as well, who need the connections.

Maybe limit the max concurrent connections postfix is allowed to make (so split up the user ispconfig to (f.e.) ispconfig_adm and ispconfig_mail. Set the mail user to only use X amount of connections, so the server admin nor the website users won't be affected when a server gets hammered by spammers.

Maybe limit the max concurrent connections postfix is allowed to make (so split up the user ispconfig to (f.e.) ispconfig_adm and ispconfig_mail. Set the mail user to only use X amount of connections, so the server admin nor the website users won't be affected when a server gets hammered by spammers.

Click to expand...

Yes, that might be the best option.

I havent seen any negative effects with a high max connection numbers yet on a server. Mysql seems to handle that well and postfix keeps the connections open in sleep state but does not use them that much in comparison to e.g. websites that might have only few open connections but do many queries trough them.

The problem described in tnhis hread is about email settings, your website problem is not related to that. Please take a look into the error.log of the website, you will find the error message there. And plee make a new thread for that