暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PostgreSQL 12 preview - libpq 增加参数 tcp_user_timeout ,连接异常关闭时会话占用时间可控(TCP_USER_TIMEOUT)

digoal 2019-04-09
636

作者

digoal

日期

2019-04-09

标签

PostgreSQL , libpq , tcp_user_timeout , tcp , keepalive


背景

```
Add support TCP user timeout in libpq and the backend server
author Michael Paquier michael@paquier.xyz
Sat, 6 Apr 2019 14:23:37 +0800 (15:23 +0900)
committer Michael Paquier michael@paquier.xyz
Sat, 6 Apr 2019 14:23:37 +0800 (15:23 +0900)
commit 249d64999615802752940e017ee5166e726bc7cd
tree 0e66ac1723a854999e136e0c8cb3c3c4442b589d tree | snapshot
parent 959d00e9dbe4cfcf4a63bb655ac2c29a5e579246 commit | diff
Add support TCP user timeout in libpq and the backend server

Similarly to the set of parameters for keepalive, a connection parameter
for libpq is added as well as a backend GUC, called tcp_user_timeout.

Increasing the TCP user timeout is useful to allow a connection to
survive extended periods without end-to-end connection, and decreasing
it allows application to fail faster. By default, the parameter is 0,
which makes the connection use the system default, and follows a logic
close to the keepalive parameters in its handling. When connecting
through a Unix-socket domain, the parameters have no effect.

Author: Ryohei Nagaura
Reviewed-by: Fabien Coelho, Robert Haas, Kyotaro Horiguchi, Kirk
Jamison, Mikalai Keida, Takayuki Tsunakawa, Andrei Yahorau
Discussion: https://postgr.es/m/EDA4195584F5064680D8130B1CA91C45367328@G01JPEXMBYT04
```

tcp_user_timeout (integer)

Specifies the number of milliseconds that transmitted data may remain unacknowledged before a connection is forcibly closed. A value of 0 uses the system default. This parameter is supported only on systems that support TCP_USER_TIMEOUT; on other systems, it must be zero. In sessions connected via a Unix-domain socket, this parameter is ignored and always reads as zero.

参考

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=249d64999615802752940e017ee5166e726bc7cd

PostgreSQL 许愿链接

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

9.9元购买3个月阿里云RDS PostgreSQL实例

PostgreSQL 解决方案集合

德哥 / digoal's github - 公益是一辈子的事.

digoal's wechat

文章转载自digoal,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论