update:長いクエリのキャッシュ更新時間を調べたところ、サーバーのクラッシュ時間と衝突しませんでした。
update2:問題の原因を見つけました。ソケットタイムアウトを適切に設定したように見えても、広告サーバーがダウンしてサーバーがハングします。タイムアウトの動作をテストする方法はありますか?
非常に忙しいサーバーがあります。〜3Kの同時接続サーバーには32GBのRAM2xCPUが搭載されています。サービスを利用できないというエラーの問題があります。サーバーは500エラーで応答せず、エラーログには数百/数千行が表示されます。
[warn] mod_fcgid: can't apply process slot for /var/www/fcgi-bin.d/php5-default/php-fcgi-wrapper
構成エラーまたはデータベース接続/クエリエラーの可能性があると考えられます。phpプロセスは、非常に複雑なクエリ結果であるキャッシュを更新します。3つの個別のクエリが1日2回実行されます。遅いクエリログを有効にしました。この場合、クエリがphpの実行時間制限である20秒を超えていると思われます(次のファイルで設定)。どんな助けでも大歓迎です。
mod_fcgidでapacheworkermpmモデルを使用します。
fcgid.confファイルは次のとおりです。
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
SocketPath /var/lib/apache2/fcgid/sock
# Communication timeout: Default value is 20 seconds
IPCCommTimeout 20
# Connection timeout: Default value is 3 seconds
IPCConnectTimeout 3
そして/etc/apache2/conf.d/php-fcgid.confファイル:
<IfModule !mod_php4.c>
#php.iniへのパス<96>のデフォルトは/ etc / phpX / cgi DefaultInitEnv PHPRC = / etc / php5 / cgi
# Number of PHP childs that will be launched. Leave undefined to let PHP decide.
# DefaultInitEnv PHP_FCGI_CHILDREN 8
# Maximum requests before a process is stopped and a new one is launched
DefaultInitEnv PHP_FCGI_MAX_REQUESTS 5000
# Maximum requests a process handles before it is terminated
MaxRequestsPerProcess 1500
# Maximum number of PHP processes.
MaxProcessCount 45
# Define a new handler "php-fcgi" for ".php" files, plus the action that must follow
AddHandler php-fcgi .php
Action php-fcgi /fcgi-bin/php-fcgi-wrapper
# Define the MIME-Type for ".php" files
AddType application/x-httpd-php .php
# Define alias "/fcgi-bin/". The action above is using this value, which means that
# you could run another "php5-cgi" command by just changing this alias
Alias /fcgi-bin/ /var/www/fcgi-bin.d/php5-default/
# Turn on the fcgid-script handler for all files within the alias "/fcgi-bin/"
<Location /fcgi-bin/>
SetHandler fcgid-script
Options +ExecCGI
</Location>
Apache2ワーカーmpm構成:
<IfModule mpm_worker_module>
StartServers 10
MaxClients 2048
ServerLimit 2048
MinSpareThreads 30
MaxSpareThreads 100
ThreadsPerChild 64
ThreadLimit 100
MaxRequestsPerChild 5000
このWebページの手順を確認し、高サーバー構成をロードしました:http: //2bits.com/articles/apache-fcgid-acceptable-performance-and-better-resource-utilization.html
update:長いクエリのキャッシュ更新時間を調べたところ、サーバーのクラッシュ時間と衝突しませんでした。
update2:問題の原因を見つけました。ソケットタイムアウトを適切に設定したように見えても、広告サーバーがダウンしてサーバーがハングします。タイムアウトの動作をテストする方法はありますか?