
3rd October 2011, 14:21
|
|
Senior Member
|
|
Join Date: Sep 2008
Location: The Netherlands
Posts: 911
Thanks: 12
Thanked 95 Times in 92 Posts
|
|
High spam mail traffic -> max mysql connections
Hey there,
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.
|

4th October 2011, 09:37
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,886
Thanks: 691
Thanked 4,188 Times in 3,205 Posts
|
|
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.
|

4th October 2011, 09:47
|
|
Senior Member
|
|
Join Date: Sep 2008
Location: The Netherlands
Posts: 911
Thanks: 12
Thanked 95 Times in 92 Posts
|
|
Yes it does
max_connections = 250
max_user_connections = 0
A value of 0 means "no limit", so it'll go up to 250 if needed.
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.
|

4th October 2011, 09:55
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,886
Thanks: 691
Thanked 4,188 Times in 3,205 Posts
|
|
Quote:
|
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.
|
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.
|

4th October 2011, 10:09
|
|
Senior Member
|
|
Join Date: Sep 2008
Location: The Netherlands
Posts: 911
Thanks: 12
Thanked 95 Times in 92 Posts
|
|
Assigning more connections you can run OOM when mysql gets a sudden increase in connections, I've seen it before on servers, they die, swap, whatever .. it's not a pretty picture
They stay in sleep state, true, but they aren't re-used (although, so it seems on my server), they need to time out before they are being dropped, so eventually you'll run out of connections.
I'll give the max500 a try and see how it goes, i'll also check and see if it's possible to limit the amount of hammering postfix does on the server.
|

4th October 2011, 10:37
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,886
Thanks: 691
Thanked 4,188 Times in 3,205 Posts
|
|
You can try to use the postfix proxymap service to get better postfix mysql connection handling.
|

5th October 2011, 05:11
|
|
HowtoForge Supporter
|
|
Join Date: Nov 2005
Location: nj usa
Posts: 217
Thanks: 13
Thanked 10 Times in 9 Posts
|
|
after my upgrade to 3.0.3.3 i have one site that is showing a blank index page. i assume that you are talking about editing
i did not see these settings in this file so i added
Code:
max_connections = 500
max_user_connections = 500
and then restarted mysql
Code:
/etc/init.d/mysql start
i checked the site and it is still white pages did i miss something?
i have 3 out of 4 sites running and they are all ok its just the one
kwick
__________________
Operating system Ubuntu Linux 10.04.4
ISPConfig Version: 3.0.4.3
Webmin version 1.580
Kernel and CPU Linux 2.6.32-40-server on x86_64
Processor information AMD Phenom(tm) II X4 945 Processor, 4 cores
Real memory 4.0 GB total
Last edited by kwickcut; 5th October 2011 at 05:13.
|

5th October 2011, 08:05
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,886
Thanks: 691
Thanked 4,188 Times in 3,205 Posts
|
|
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
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 11:09.
|
Recent comments
8 hours 45 min ago
13 hours 43 min ago
15 hours 10 min ago
16 hours 3 min ago
17 hours 46 min ago
22 hours 9 min ago
23 hours 1 min ago
1 day 1 hour ago
1 day 14 hours ago
1 day 15 hours ago