2

私は現在、数人 (~15) のユーザーが毎日 1 回ログインしている Web アプリを実行しており、その後、5 分ごとに新しいコンテンツで自動的に更新される Web アプリを開いたままにしています。各ユーザーは、約 15 ~ 18 時間開いている傾向があります。

しかし、ユーザーがクリティカル マス (~30 ~ 40) になると、すべての処理が劇的に遅くなり、HTTPD プロセスのメモリ使用量が急増し始めます。Apache を 1 時間に 1 回再起動する cron ジョブを追加しましたが、これは多少の効果しかありません。すべてのコンテンツは動的に生成され、新しい再生時間になるため、ページのキャッシュはオプションではありません。

Timeout、MaxRequest、KeepAlive オプションをいじり始めましたが、過去にこれらを常にデフォルトのままにしていたため、ガイダンスをいただければ幸いです。

これが私が持っているものです。上記のシナリオでこの構成を最適化する方法について、Apache の天才はいますか? ロード時間が非常に長くなる場合があるため、長いタイムアウトが良いと考えました。

# Timeout: The number of seconds before receives and sends time out.

Timeout 200

# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.

KeepAlive On

# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.

MaxKeepAliveRequests 100

# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.

KeepAliveTimeout 60

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers       16
MinSpareServers    10
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  4000
</IfModule>
4

1 に答える 1

2

これはおそらくServerFaultに入る良い質問です。

サーバーがスワッピングしている可能性があります (RAM の不足)。

ディレクティブMaxClientsは次のようになります。

MaxClients ≈ (RAM - size_all_other_processes)/(size_apache_process)

apache を微調整する方法を説明するいくつかの記事を調べることができます

Cron再起動はそうではありません! 良いアイデアです。多分一日一回。しかし、この問題をそのように解決しようとしないでください。

それが役に立てば幸い!

于 2010-08-04T20:21:22.277 に答える