Arval SQLException: FATAL: sorry, too many clients already in postgres

后端 未结 2 813
别跟我提以往
别跟我提以往 2020-12-16 03:15

I am using a database in PostgreSQL 9.1,in which entry are coming continuously from another program . I am sending request from Ajax after 6 sec to fetch the latest entry.to

相关标签:
2条回答
  • 2020-12-16 03:45

    To increase the connection limit you may like the following document.

    This solution is tested on ubuntu 12.04.

    1. Make following changes in postgresql.conf file :

    Open /etc/postgresql/9.1/main/postgresql.conf

    max_connections = 200
    shared_buffers = 100MB
    max_files_per_process = 100
    

    Reference: shared_buffers size should be less than shmmax size.

    2. Commands to check shmmax:

    $ sysctl -e kernel.shmmax
    $ ipcs -l
    

    Reference: Adjusting shmmax and shmall

    3. Increase the size of shmmax:

    Run the following command:

    $ sysctl -w kernel.shmmax=134217728
    $ sysctl -w kernel.shmall=2097152
    

    and write on top in /etc/sysctl.conf file:

    kernel.shmmax=134217728
    kernel.shmall=2097152
    

    Reference : SHMMAX in Ubuntu

    4. Restart postgresql

    $ service postgresql restart
    

    Links:

    http://www.varlena.com/GeneralBits/Tidbits/perf.html

    http://www.postgresql.org/docs/9.1/static/runtime-config-resource.html

    0 讨论(0)
  • 2020-12-16 03:46

    You can increase the max_connections in postgres, that is not the solution though. You have resource leaks. It could be any - connection not closed, result set not closed. Please go back and check the code.

    Consider using a connection pooling library like c3p0/BoneCp

    A general discussion on connection pooling is here (Thanks to @sinisa229 mihajlovski)

    0 讨论(0)
提交回复
热议问题