Re: max_db_connections

Paul J Stevens <[email protected]>
Newsgroups gmane.mail.imap.dbmail
Message-ID <[email protected]>

On 31-10-14 15:28, Rogerio Pereira wrote:
> Hi,
> 
> I need suggestions about max_db_connections.
> 
> Imapd usually hangs in my DBmail instance running 3.1.17 in a daily basis.
> 
> /dbmail-imapd[10702]: [0x18e6f90] Alert:[db] db_con_get(+254): Thread is
> having trouble obtaining a database connection. Try [0]/
> 
> / pool[10726]: segfault at 0 ip:00007fc0c2b53e20 sp 00007fc0b9fa5660
> error 4 in libzdb.so.9.0.2[7fc0c2b4b000+1a/
> 
> I decided to change max_db_connections from 10 to 20.
> 
> Is it OK? What are the chances to get it worst than before? My server
> has 1900 users, average of 30 simultaneous user connections, PgSQL 9.3
> in a separate server and 120 GB total DB size.

Ok. Nice. The Alert in itself is not a problem. DBMail will retry to
obtain a connection after waiting for 1 second, and retry until it can
get one.

If you see ... Try [x] where x keeps growing, then you might want to
consider increasing the max_db_connections. But if the database is
already very busy that will not help very much, unless your database
server is a really big iron.

> 
> Another question: Pop3d does not throw this error in dbmail.err. I guess
> this service will be impacted by the same DB imapd connection issue. Is
> this pop3d error a symptom of the same problem?

No. pop3d is event-driven but single threaded, and will never handle
more than one single database connection concurrently.

>  dbmail-pop3d[17231] general protection ip:7ffd411f180a sp:7fff0c6799c8
> error:0 in libdbmail.so.0.0.0[7ffd411ad000+6b000]

With that many users I would start load-balancing:

 [nginx] -> [dbmail-1...x] -> [db]

where nginx (or another mail proxy like dovecot or haproxy) will
distribute connections over a number of dbmail instances.

Also allows for better uptime during restarts, etc.

-- 
________________________________________________________________
Paul J Stevens       pjstevns @ gmail, twitter, github, linkedin
           www.nfg.nl/[email protected]/+31.85.877.99.97
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.