Quote:
Originally Posted by linuxengineer
hi,
I am having a postgresql db server. The problem is that the number of idle connections are incresing as time passes. these idle connections are not disconnecting automatically. after a long time these connections will be in large number and the website is not accessible. what is the reason behind this and is there any solution for this without restarting the server or killing the connections manually?
|
In the file "postgresql.conf" there are options "tcp_keepalives_idle", "tcp_keepalives_interval" and "tcp_keepalives_count" you can check
the documentation.
You must change sysctl values,
this explanation will clarify how to set variables. The above explanation also applies to the file "postgresql.conf".
In slackware (or any gnu/linux) by default have net.ipv4.tcp_keepalive_time = 7200, net.ipv4.tcp_keepalive_probes = 9 and net.ipv4.tcp_keepalive_intvl = 75, then the system will close connections after 7875 seconds or 2.18 hours ( 7200 + ( 9 * 75 )).
Quote:
Originally Posted by linuxengineer
Also in some occasions while i try to submit data via web page into the database, an error occurs like "error while sending data to the server. Please try again later". this error is not loogged in any of the log files and i also want to know whether this occur due to the large number of idle connections existing in database server ??? If not what can be the reason behind this error ???
|
I think you need to configure the
error log, there must be generated if PostgreSQL was blocked by excess connections and otherwise.
The best thing to do is ask the
postgresql list.