![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I continue the old theme what is named "When the session ends": http://archives.postgresql.org/pgsql...6/msg00913.php I want to trying this in live - I thought, because somewhere some people thinking about replace a big ElevateDB database with PostgreSQL. The ElevateDB is uses "timeout" and "dead session timeout" parameter. The first is interval when the server saying "this is inactive connection", and the second is fully drop this dead session. If the inactive is activated (reconnect) then we can work again. So today I started and experience with two PC (Win7 server, WXP client). PG9, PGAdmin v14. The statement timeout is 5 minute, the tcp_keepalive is default. |
#3
| |||
| |||
|
|
durumdara wrote: I continue the old theme what is named "When the session ends": http://archives.postgresql.org/pgsql...6/msg00913.php I want to trying this in live - I thought, because somewhere some people thinking about replace a big ElevateDB database with PostgreSQL. The ElevateDB is uses "timeout" and "dead session timeout" parameter. The first is interval when the server saying "this is inactive connection", and the second is fully drop this dead session. If the inactive is activated (reconnect) then we can work again. So today I started and experience with two PC (Win7 server, WXP client). PG9, PGAdmin v14. The statement timeout is 5 minute, the tcp_keepalive is default. [but aborted connections don't get closed on the server] statement_timeout does not come into play here. Could you post the result of SELECT current_setting('tcp_keepalives_idle'), * * * *current_setting('tcp_keepalives_interval'), * * * *current_setting('tcp_keepalives_count'); Yours, Laurenz Albe |
#4
| |||
| |||
|
|
But: after (I started the XP client) 2 hours passed, and the sessions starting to vanish one by one. So may the timeout is "2 hours" now in the system (Win7/x64). Read this:http://technet.microsoft.com/en-us/l...36(WS.10).aspx REG_DWORD * * * *0x1–0xFFFFFFFF (milliseconds) * * * * 0x6DDD00 (7,200,000 milliseconds = 2 hours) Thanks: * *dd |
#5
| |||
| |||
|
|
I continued the testing. This value is commonly used to abort the TCP alives at a specific time: HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Param eters\KeepAliveTime But: my opinion that this "hacking" of the system is very wrong. |
#6
| |||
| |||
|
|
durumdara *<durumd... (AT) gmail (DOT) com> wrote: If you want to control session timeouts without changing your TCP settings, I think the usual way is to use a connection pooler in front of your PostgreSQL server. For example, pgbouncer's client_idle_timeout setting looks like it will do what you want; seehttp://pgbouncer.projects.postgresql.org/doc/config.html |
#7
| |||
| |||
|
|
So today I started and experience with two PC (Win7 server, WXP client). PG9, PGAdmin v14. The statement timeout is 5 minute, the tcp_keepalive is default. [but aborted connections don't get closed on the server] statement_timeout does not come into play here. Could you post the result of SELECT current_setting('tcp_keepalives_idle'), current_setting('tcp_keepalives_interval'), current_setting('tcp_keepalives_count'); PGADMIN shown: -1, -1, 0 But: after (I started the XP client) 2 hours passed, and the sessions starting to vanish one by one. So may the timeout is "2 hours" now in the system (Win7/x64). So: what I can do to set this value lower? Is it enough to parameterize the registry on the server? Why the PGSQL isn't supports a value that set timeout, when the server "abort" the tcp connection on session? This can override the default tcp parameters. |
#8
| |||
| |||
|
|
But I don't know that pgbouncer CAN reset fully the connection? For example: If the connection locks resources, starting a transaction, prepare statements, etc., plus create advisory locks, can the pgbouncer reset this connection fully (unlock, rollback, unprepare, destroy adv. locks)? |
#9
| |||
| |||
|
|
durumdara wrote: So today I started and experience with two PC (Win7 server, WXP client). PG9, PGAdmin v14. The statement timeout is 5 minute, the tcp_keepalive is default. [but aborted connections don't get closed on the server] statement_timeout does not come into play here. Could you post the result of SELECT current_setting('tcp_keepalives_idle'), current_setting('tcp_keepalives_interval'), current_setting('tcp_keepalives_count'); PGADMIN shown: -1, -1, 0 But: after (I started the XP client) 2 hours passed, and the sessions starting to vanish one by one. So may the timeout is "2 hours" now in the system (Win7/x64). So: what I can do to set this value lower? Is it enough to parameterize the registry on the server? Why the PGSQL isn't supports a value that set timeout, when the server "abort" the tcp connection on session? This can override the default tcp parameters. Probably I'm misunderstanding something crucial here, but why don't you set tcp_keepalives_idle=600 or something similar if two hours is too long for you? These parameters are there specifically so that you can change the settings for PostgreSQL without changing the operating system's TCP settings. Yours, Laurenz Albe |
|
Or you can set system-wide settings in Windows registry HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Param eters using KeepAliveInterval and KeepAliveTime settings (count is always 10 on Windows Vista and later). |
#10
| |||
| |||
|
|
Probably I'm misunderstanding something crucial here, but why don't you set tcp_keepalives_idle=600 or something similar if two hours is too long for you? These parameters are there specifically so that you can change the settings for PostgreSQL without changing the operating system's TCP settings. With your answer I found a solution, but I don't know it is working on every machine or not. In Win7/x64 it is working. So: In Windows the count is not usable. It is ALWAYS 10! |
|
I experienced that I have two ways to set these values. 1.) Basically the postgresqls.conf 2.) set parameters before query (this override 1.) Every of them effective, I tried it with two queries from another machine. |
|
I don't know that what happens in other machines. |
![]() |
| Thread Tools | |
| Display Modes | |
| |