Search Postgresql Archives

Re: Postfix/Maildrop and too many connections issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I run postfix and have it connected to postgresql for just about everything. Postfix is very sloppy on the database side, or so it seems.

I ended up having to configure postfix to limit the number of processes it will start, and then make sure postgres has more than that connections available too.

In postfix, I set "default_process_limit = 10" in main.cf. In postgresql, I set max connections to 256, with 4 reserved for super user. My mail volume also isn't too bad, typically, so I can get away with setting this to 10. In some cases, I think each postfix process is opening a new database connection for every lookup. And, if a process needs to lookup 2 or 3 items, it uses new connections for every one. Then, the connections don't get closed until those processes are killed a little while later.

Pure speculation, but it's about the only thing I can think of (short of going through and analyzing the source code) that would explain the disparity between postfix processes and postgres connections.

With that, I have the following in ps (after running for a while, so things are mostly stable):

Postgres Connections (not including stats): 43

Postfix:
transport: 15
virtual: 13
mailbox: 8
domains: 2

Courier IMAP/POP
courier: 5

These numbers will fluctuate with mail traffic. And, they do not correspond with the open # of postfix processes (19 processes: 1 master, 1 qmgr, 2 trivial rewrite, 7 smtpd, 6 cleanup, 1 pickup, 1 virtual).

That leads me to believe that the postfix database interface (for postgres at least) is pretty sloppy. I've been planning to try a pooling program, just to see if that would make a difference, but I haven't had time to do any research or practical testing to find out. Does anyone know if this problem occurs when using postfix with LDAP servers or mysql ?

Thanks,
Greg

On Jun 21, 2005, at 12:00 PM, Sven Willenberger wrote:

We have a system set up whereby postfix and maildrop gather user info
from a pg database (7.4.2 on FreeBSD 5.2.1) to do local mail acceptance
and delivery. I have configured max connections at 512 but I find that
this is not enough and I get "connection limit exceeded for
non-superusers" errors. I see upon ps ax that there are hundreds of idle
connections (state I).

Is there any way on the server end to close these connections (the
process is apparently for postfix and then maildrop to open a
connection, run one select statement, and supposedly close the
connection). If not, would pgpool help in this case? Since all the
connections are basically 2 users (one for the mail delivery system and
another for the mail retrieval), are there any such "connections"
limitation by pgpool (i.e. if we get a spike of 700-1000 queries each
with their own "connection")?

Thanks,

Sven


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux