Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 3rd October 2011, 14:21
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default 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.
__________________
Real men don't backup... Real men cry!

http://www.e-rave.nl/
Reply With Quote
Sponsored Links
  #2  
Old 4th October 2011, 09:37
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 35,771
Thanks: 821
Thanked 5,331 Times in 4,183 Posts
Default

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.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 4th October 2011, 09:47
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

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.
__________________
Real men don't backup... Real men cry!

http://www.e-rave.nl/
Reply With Quote
  #4  
Old 4th October 2011, 09:55
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 35,771
Thanks: 821
Thanked 5,331 Times in 4,183 Posts
Default

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.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 4th October 2011, 10:09
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

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.
__________________
Real men don't backup... Real men cry!

http://www.e-rave.nl/
Reply With Quote
  #6  
Old 4th October 2011, 10:37
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 35,771
Thanks: 821
Thanked 5,331 Times in 4,183 Posts
Default

You can try to use the postfix proxymap service to get better postfix mysql connection handling.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Undelivered Mail Returned to Sender djmixx07 Server Operation 27 18th June 2010 12:57
ISPconfig 3 some users cannot send email to outside Rockblade Installation/Configuration 7 29th April 2010 01:40
just the last step...and it works. Postfix...need help config. ubuntusr Installation/Configuration 1 5th January 2009 09:50
Filtering emails using Spamassassin and Clamav for Exchange 2000 Server Rocky Server Operation 19 11th March 2008 08:27
Virtual Users And Domains With Postfix, Courier And MySQL (+ SMTP-AUTH, Quota, SpamAs ebbay Installation/Configuration 9 4th March 2006 11:47


All times are GMT +2. The time now is 07:34.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.