Mailing List Archive

max_db_connections
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.

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?

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

Regards.





Rogerio
Re: max_db_connections [ In reply to ]
Rogerio,



I think postgre allows less connection than your max_connections setting.



From: dbmail-bounces@dbmail.org [mailto:dbmail-bounces@dbmail.org] On Behalf
Of Rogerio Pereira
Sent: sexta-feira, 31 de Outubro de 2014 14:29
To: dbmail@dbmail.org
Subject: [Dbmail] max_db_connections



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.

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?

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

Regards.





Rogerio
Re: max_db_connections [ In reply to ]
Hi Jorge,

My postmaster.conf file is properly configured. My OS is CentOS 6.5. PgSQL logfiles don’t show any connection restrictions.

Max_connections = 100

Regards.

Rogerio
Re: max_db_connections [ In reply to ]
If you want to kill your postgres server that is a good idea :-)

Seriously: DBMail has a kick-ass database pooling mechanism. If you need
more than 10 database connections you are having problems of a different
nature, or you are running a setup with hundreds if not thousands of
*very* active users.



On 31-10-14 18:38, Rogerio Pereira wrote:
> Hi Jorge,
>
> My postmaster.conf file is properly configured. My OS is CentOS 6.5.
> PgSQL logfiles don’t show any connection restrictions.
>
> Max_connections = 100
>
> Regards.
>
> Rogerio
>
>
> _______________________________________________
> DBmail mailing list
> DBmail@dbmail.org
> http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail
>

--
________________________________________________________________
Paul J Stevens pjstevns @ gmail, twitter, github, linkedin
www.nfg.nl/info@nfg.nl/+31.85.877.99.97
_______________________________________________
DBmail mailing list
DBmail@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail
Re: max_db_connections [ In reply to ]
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/info@nfg.nl/+31.85.877.99.97
_______________________________________________
DBmail mailing list
DBmail@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail