OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: mysql proxy connexions limit

From: Wietse Venema (wietseporcupine.org)
Date: Thu Mar 15 2007 - 12:10:14 CDT


Victor Duchovni:
> On Thu, Mar 15, 2007 at 05:45:53PM +0100, mlsd2i.fr wrote:
>
> > How to limit the number of connexions opened by postfix to mysql ?
> >
> > I set the max process to 10 in master.cf for proxymap but i still have
> > 40+ persistant connexions to mysql for postfix user, why ? is that max
> > process for each map or is it global ?
>
> You are likely using 4 different MySQL tables, and I don't believe that
> mySQL tables have connection sharing (as with LDAP).

Apparently not:

    typedef struct {
        MYSQL *db;
        ...
    } HOST;

    typedef struct {
        int len_hosts; /* number of hosts */
        HOST **db_hosts; /* the hosts on which the databases
                                             * reside */
    } PLMYSQL;

    typedef struct {
        DICT dict;
        ...
        PLMYSQL *pldb;
    #if defined(MYSQL_VERSION_ID) && MYSQL_VERSION_ID >= 40000
        HOST *active_host;
    #endif
    } DICT_MYSQL;

We could share the PLMYSQL object among multiple DICT_MYSQL objects.
Just give the PLMYSQL object a reference count so it gets cleaned
up when the last MySQL map is closed.

        Wietse