Php 在谷歌云上获得502坏网关
我有一个n1-highcpu-16(16个vCPU,14.4 GB内存)。我有一个Bitnami NGINX设置 当我有大约400-600人在现场时,它有时会给502个坏网关。我用它来运行机器人,所以它会给我带来很大的错误。当站点接收到大约50-100个对PHP文件的请求时,就会发生这种情况,PHP文件执行一个SQL连接。 之后,在我的网站上出现了502坏网关错误 有没有解决办法来解决这个问题 我的PHP设置:Php 在谷歌云上获得502坏网关,php,mysql,nginx,google-compute-engine,google-cloud-platform,Php,Mysql,Nginx,Google Compute Engine,Google Cloud Platform,我有一个n1-highcpu-16(16个vCPU,14.4 GB内存)。我有一个Bitnami NGINX设置 当我有大约400-600人在现场时,它有时会给502个坏网关。我用它来运行机器人,所以它会给我带来很大的错误。当站点接收到大约50-100个对PHP文件的请求时,就会发生这种情况,PHP文件执行一个SQL连接。 之后,在我的网站上出现了502坏网关错误 有没有解决办法来解决这个问题 我的PHP设置: pm=static ; The number of child processes
pm=static
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children=50
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers=5
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers=5
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers=30
; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
;pm.process_idle_timeout = 10s;
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
pm.max_requests = 5000
您确定这是SQL连接的问题吗?因为您的
pm.max_children
被设置为50
,如果所有50个线程都在使用中,将抛出502坏网关错误。您应该尝试启动其他服务器来处理更多请求
或者,尝试升高和降低
pm.max_children
,看看这是否会影响数字,并帮助得出结论。您确定这是SQL连接的问题吗?因为您的pm.max_children
被设置为50
,如果所有50个线程都在使用中,将抛出502坏网关错误。您应该尝试启动其他服务器来处理更多请求
或者,尝试升高和降低pm.max_children,看看这是否会影响数字,并帮助得出结论。HTTP错误(如502)是一种症状,它告诉您执行类似“检查应用程序日志”的操作。502特别表示与上游服务器的连接有问题,既然您提到您使用一个SQL连接来处理所有请求流量,我猜这可能与此有关。我只是注意到这是一个月前发布的,而不是今天,因此,请告诉我们您是否找到了此问题的解决方案。像502这样的HTTP错误是一种症状,它告诉您执行类似“检查应用程序日志”的操作。502特别表示与上游服务器的连接有问题,既然您提到您使用一个SQL连接来处理所有请求流量,我猜这可能与此有关。我只是注意到这是一个月前发布的,而不是今天,所以,如果你找到了这个问题的解决方案,请告诉我们。