postfix with mysql - too many connections

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

postfix with mysql - too many connections

Mathias Rothe
Hello,

I use postfix with policyd-weight and mysql maps (froxlor interface).

Very often I got mysql errors "too many connections", but in the my.cnf "max_connections = 500" was already set.
The Postmaster received Mails: Postfix SMTP server: errors from ....
I found in mail.log:
warning: mysql:/etc/postfix/mysql-virtual_alias_maps.cf lookup error for [hidden email]
warning: DD03C2982F24: virtual_alias_maps map lookup problem for [hidden email] -- message not accepted, try again later

So I checked mysql with "mysqladmin -pPASSWORD extended-status | grep -wi 'threads_connected\|threads_running' | awk '{ print $2,$4}'" and found some hundred open connections.
With  ' mysql -pPASSWORD -e "show processlist;" ' I found most of them was postfix processes in status sleep.

As workaround I used now proxymap and the problems are solved:

[code]
proxy_read_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_maps.cf,
                  proxy:mysql:/etc/postfix/mysql-virtual_mailbox_domains.cf,
                  proxy:mysql:/etc/postfix/mysql-virtual_alias_maps.cf,
                  proxy:unix:passwd.byname

virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_maps.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_domains.cf
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_alias_maps.cf
[/code]

But I think it would be a better way, if postfix could close the mysql connections immediately after receiving the data and not hold opened until the mail is fully delivered.

Thank you.


Best regards,
Mathias
Reply | Threaded
Open this post in threaded view
|

Re: postfix with mysql - too many connections

Wietse Venema
Mathias Rothe:
> As workaround I used now proxymap and the problems are solved:

This is not a workaround. Sharing connections is the recommended
configuration.

> But I think it would be a better way, if postfix could close the mysql
> connections immediately after receiving the data and not hold opened
> until the mail is fully delivered.

Doing a connect+close for every query would reduce performance on a
high-volume server.

        Wietse