最近凌晨 php 的日志都会报有几十条数据进行更新的时候,连不上 pg 数据库,我稍微看了下监控,每次都是 CPU 高的时候,所以我想问 pg 数据库高,会不会导致 php 程序连不上数据库?
最近凌晨 php 的日志都会报有几十条数据进行更新的时候,连不上 pg 数据库,我稍微看了下监控,每次都是 CPU 高的时候,所以我想问 pg 数据库高,会不会导致 php 程序连不上数据库?
|
wps353Feb 27, 2019
1
有这个可能性。
我觉得更应该去查下 pg 的 CPU 高的原因。 |
|
snowfuckFeb 27, 2019
2
要看看为啥 CPU 那么高,看看 PG 配置,连接数多少。是不是连接数满了?
|
|
4
我又看了下 Pg 的配置文件,tcp_keepalives_interval = 10 会不会和这条参数有关
|
|
GooooooniXFeb 27, 2019
5
@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; |