2

I had a PostgreSQL based web application that run into no connection left problem. so I used pgbouncer to solve this problem. It works very much better with pgbouncer but I'm still having some problems with connection limit... Right now my postgresql.conf file contains:

max_connections = 100
shared_buffers = 128MB
#temp_buffers = 8MB
#max_prepared_transactions = 0
#work_mem = 1MB
#maintenance_work_mem = 16MB
#max_stack_depth = 2MB
#temp_file_limit = -1
#max_files_per_process = 1000
#shared_preload_libraries = ''

and my pgbouncer.ini file:

pool_mode = session
max_client_conn = 100
default_pool_size = 45
reserve_pool_size = 1

It still encounters some connection limit problems at peak time of site. Can you help me configure this settings to better configuration. Thanks in advance.

Ehphan
  • 537
  • 3
  • 7
  • 19
  • Do you really want your pgbouncer conf to match that of the PostgreSQL limits? I'd personally increase max_connections to something 20% higher than pgbouncer. Secondly, what resource is allocated to the machine in terms of RAM? Is there any reason you only have the default max_connection set to 100 when PostgreSQL is capable of dealing with at least 5+ times this? Understanding the underlying infrastructure will help. Can you also post your work_mem setting? – d1ll1nger Jun 13 '16 at 12:03
  • work_mem is commented but default value is 1MB – Ehphan Jun 13 '16 at 12:21

0 Answers0