MySQL connectons maxing out ...

Discussion in 'General' started by mike_p, Apr 12, 2012.

  1. mike_p

    mike_p Member

    Having had my server running flawlessly recently I was surprised this morning to find MySQL errors occurring - "Too Many Connections... "

    After a MYSQL restart, things would work okay and then fail after a few minutes with the same problem.

    My max_connections setting was at the defaul 100
    - and it seems ispconfig was using 98 of those - then the errors were occurring.

    After some trial and error, I've now found that by increasing the max_connections I can keep things running okay, but ispconfig has settled to using about 150 connections.

    Why has this suddenly started happening?

    (In my.cnf I've now set max_connections to 1000 and max_user_connections to 200 and we seem to be stable.)
     
  2. till

    till Super Moderator

    100 connections are too few, I would set max_connections and max_user_connections to 500. This can happen when e.g. a lot of mails come in or when several web spiders like google, bing etc. spider a website that uses mysql.
     
  3. mike_p

    mike_p Member

    Thanks for the reply.

    Having run 'show full processlist' in mysql, I note that the majority of the connections form ispconfig are marked 'Sleep' - ie connection is idle. Is there an ispconfig process that is using a permanent connection where it shouldn't be used?
    Or should ispconfig be closing the mysql connections after the process has finished?
     
  4. till

    till Super Moderator

    These connections are not from ispconfig. You mix up the mysql username "ispconfig" with the software "ispconfig" here. The mysql username ispconfig is used by all software packages that read data from mysql and the connections you refer to are from postfix, amavisd, pure-ftpd dovecot, courier and vlogger and the connection is idle of course if the daemons dont need it at the moment e.g. because the postfix process that opened the connection does not need to query the database at that momentyou executed the command.

    Everything is as it should on your server, you had just a connection limit that was too low.
     
  5. mike_p

    mike_p Member

    Thanks for the explanation Till.

    I've also now discovered that one of my client's email addresses had been put as a spoofed return address on a Nigerian scam email, so her email was being bombarded with rejections and complaints. This caused the overload.

    Having changed the max_connections settings the system soon settled down.
     

Share This Page