php-fpm里面的这两个参数
如果php-cgi在xx时间内有xx个进程因为资源不足退出就平滑重启

; If this number of child processes exit with SIGSEGV or SIGBUS within the time
; interval set by emergency_restart_interval then FPM will restart. A value
; of '0' means 'Off'.
; Default Value: 0
emergency_restart_threshold = 5

; Interval of time used by emergency_restart_interval to determine when
; a graceful restart will be initiated. This can be useful to work around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds

这个修改后运行一段时间,确实有效

还有一种是监听两个php-cgi端口
; Default Value: 0,一个设为backup,写个python程序中转backup的请求,同时重启另一个php-fpm
emergency_restart_interval = 120