Apache サーバー ログから「[info] server seems busy」を解決するにはどうすればよいですか?

Apache サーバー ログから「[info] server seems busy」を解決するにはどうすればよいですか?

この質問は何度か見かけましたが、実際の答えがなかったので、私の解決策を投稿することにしました。

以下のinfoメッセージが apache error.log に表示されます。

[info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 16 children, there are 41 idle, and 129 total children

答え1

解決策は非常に明白です。StartServers問題がなくなるまで値を増やしてください。確かにそうですが、意味を理解していない限り、また増加した値が実際に役立つかどうかを理解していない場合は、値を恣意的に増やすのは悪い習慣です。

httpd のソースコードを読んでいたら、次のように書いてありました。

/*
 * idle_spawn_rate is the number of children that will be spawned on the
 * next maintenance cycle if there aren't enough idle servers.  It is
 * doubled up to MAX_SPAWN_RATE, and reset only when a cycle goes by
 * without the need to spawn.
 */

さらにソースでは、実際のエラーは次の場合にログに記録されます。

if (retained->idle_spawn_rate >= 8) {
                ap_log_error(APLOG_MARK, APLOG_INFO, 0, ap_server_conf, APLOGNO(00162)
                    "server seems busy, (you may need "
                    "to increase StartServers, or Min/MaxSpareServers), "
                    "spawning %d children, there are %d idle, and "
                    "%d total children", retained->idle_spawn_rate,
                    idle_count, total_non_dead);
            }

つまり、このエラーはリクエストを処理するためのサーバーが不足しているため、次のサイクルで生成される子の数が 8 を超える場合。

それで、どうすれば修正できるのでしょうか?

このエラーが発生するたびに、 のようなメッセージが表示されますspawning 16 children。これは、リクエストを処理するサーバーが不足していたため、16 個の子プロセスを生成する必要があったことを意味します。基本的に、StartServersエラーがなくなるまで、生成する子プロセスの数だけ を増やします。代わりに をこの量だけ増やすこともできますMin/MaxSpareServers

関連情報