meinheldはまだfapws3、竜巻のような別の非同期のWebサーバです。
meinheldはWSGI準拠のWebサーバです。
<強い>インストールの
PyPIのからインストールします。
&NBSP; easy_installを-zu meinheld
ソースからインストールします。
&NBSP; Pythonがインストールsetup.py
gunicornをサポートmeinheld。
gunicornインストールするには:
&NBSP; easy_installを-zu gunicorn
の基本的な使い方の
シンプルなWSGIアプリ:
meinheldインポートサーバーから
DEF hello_world(環境、start_responseを):
&NBSP;ステータス= '200 OK」
&NBSP; RES = "こんにちは、世界!"
&NBSP; response_headers = [( 'コンテンツタイプ'、 'text / plainの')( 'Content-Lengthの「STR(LEN(RES)))]
&NBSP; start_responseを(ステータス、response_headers)
&NBSP; RES]戻す
server.listen((「0.0.0.0」、8000))
server.run(hello_world)
gunicornと。ユーザーワーカークラス "meinheld.gmeinheld.MeinheldWorker」:
$ gunicorn --workers = 2 --workerクラス= "meinheld.gmeinheld.MeinheldWorker」gunicorn_test:アプリ
のパフォーマンスの
meinheldは、高性能http_parserを使用されている。
(http://github.com/ry/http-parserを参照してください)
高性能イベントライブラリpicoevこと利用した。
(http://developer.cybozu.co.jp/kazuho/2009/08/picoev-a-tiny-e.htmlを参照してください)
シンプルなベンチマーク
シンプルhello_worldベンチ:
DEF hello_world(環境、start_responseを):
&NBSP;ステータス= '200 OK」
&NBSP; RES = "こんにちは、世界!"
&NBSP; response_headers = [( 'コンテンツタイプ'、 'text / plainの')( 'Content-Lengthの「STR(LEN(RES)))]
&NBSP; start_responseを(ステータス、response_headers)
&NBSP; RES]戻す
apachベンチを使用します。
$ AB -c 100 -n 10000 http://127.0.0.1:8000/
スペック
&NBSP; * CPU:インテル(R)アトム(TM)のCPU N270する@ 1.60GHz
&NBSP; * Memoy:1G
&NBSP; * OS:Ubuntuの10.04
毎秒サーバー要求
meinheld 0.1 2927.62 [#/秒]
fapws3 0.6 1293.53 [#/秒]
sendfileをのの
wgsi.file_wrapper上で、(2)のsendfileを使用meinheld
の要件の:ます。
- のPythonます。
コメントが見つかりません