
最近凌晨 php 的日志都会报有几十条数据进行更新的时候,连不上 pg 数据库,我稍微看了下监控,每次都是 CPU 高的时候,所以我想问 pg 数据库高,会不会导致 php 程序连不上数据库?
1 wps353 2019 年 2 月 27 日 有这个可能性。 我觉得更应该去查下 pg 的 CPU 高的原因。 |
2 snowfuck 2019 年 2 月 27 日 要看看为啥 CPU 那么高,看看 PG 配置,连接数多少。是不是连接数满了? |
4 304464743 OP 我又看了下 Pg 的配置文件,tcp_keepalives_interval = 10 会不会和这条参数有关 |
5 CodeCore 2019 年 2 月 27 日 @304464743 PG 默认长时间不链接, 会主动发送消息到客户端,N 次之后没响应就主动断开链接了。 # see "man 7 tcp" for details tcp_keepalives_idle = 60 # TCP_KEEPIDLE, in seconds; # 0 selects the system default tcp_keepalives_interval = 10 # TCP_KEEPINTVL, in seconds; # 0 selects the system default tcp_keepalives_count = 10 # TCP_KEEPCNT; |