【发布时间】:2016-04-01 15:26:42
【问题描述】:
我拥有一个 n1-highcpu-16(16 个 vCPU,14.4 GB 内存)。我有一个 Bitnami NGINX 设置。
当我在现场有大约 400-600 人时,有时会出现 502 错误网关。我正在用它运行机器人,所以它往往会给我带来很大的错误。当站点收到大约 50-100 个对执行一个 SQL 连接的 PHP 文件的请求时,就会发生这种情况。 之后,在我的网站上出现 502 bad gateway 错误。
有什么办法可以解决吗?
我的 PHP 设置:
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
【问题讨论】:
-
像 502 这样的 HTTP 错误是一种症状,它告诉您执行“检查应用程序日志”之类的操作。 502 特别表示与上游服务器的连接出现问题,并且由于您提到您使用单个 SQL 连接来处理您的所有请求流量,我的猜测是它与此有关。
-
我刚刚注意到这是一个月前发布的,而不是今天发布的,所以如果您找到了解决此问题的方法,请告诉我们。
标签: php mysql nginx google-compute-engine google-cloud-platform