1

私はn1-highcpu-16(16 vCPUs、14.4 GBのメモリ)を所有しています。私はBitnami NGINX設定でそれを持っています。Googleの雲で502の不正なゲートウェイを取得する

私は約400~600人の人がサイトにいると、時には502の悪いゲートウェイを与えます。私はそれでボットを実行しているので、私にとって大きなエラーを起こす傾向があります。これは、サイトが1つのSQL接続を行うPHPファイルに対して約50〜100件のリクエストを受け取ったときに発生します。 その後、私のサイトで502の悪いゲートウェイエラーが表示されます。

解決方法はありますか?

私の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 
+0

502のようなHTTPエラーは、「アプリケーションログを確認する」のような処理を行うように指示する症状です。 502は、上流のサーバーへの接続に何か問題があることを具体的に意味します。また、単一のSQL接続を使用してすべての要求トラフィックを処理すると言いますから、それは何かが関係していると思います。 – Adam

+0

これは1ヶ月前に掲載されたことに気付きましたが、今日ではありませんので、この問題の解決策を見つけた場合はお知らせください。 – Adam

答えて

0

あなたは、これはSQL接続の問題ですか? pm.max_children50に設定されているため、50個のスレッドがすべて使用されている場合、502 Bad Gatewayエラーがスローされます。より多くの要求を処理するには、追加のサーバーをスピンアップする必要があります。

また、pm.max_childrenを上げ下げして数字に影響するかどうかを確認し、結論を導くのに役立ちます。

関連する問題