高性能python wsgi web服务器
minefield的Python项目详细描述
这是什么
这是meinheld的叉子, 高性能python wsgi web服务器。
雷场删除了Meinheld和 做些实验性的调整。
minefield是一个符合wsgi的web服务器。(支持pep333和pep3333)
要求
雷区需要python 2.x>;=2.7或python 3.x>;=3.3。
Minefield支持Linux、FreeBSD、Mac OS X。
安装
从pypi安装:
$ pip install -U minefield
从源安装:
$ python setup.py install
雷场支持古尼孔。
要安装Gunicorn:
$ pip install -U gunicorn
基本用法
简单的wsgi应用程序:
from minefield import server def hello_world(environ, start_response): status = '200 OK' res = b"Hello world!" response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(res)))] start_response(status, response_headers) return [res] server.listen(("0.0.0.0", 8000)) server.run(hello_world)
和古尼康在一起。用户工作类“egg:minefield gunicorn_worker”或“minefield.gminefield.minefield worker”:
$ gunicorn --workers=2 --worker-class="egg:minefield#gunicorn_worker" gunicorn_test:app
性能
对于解析http请求,meinheld使用ryan dahl的http解析器库。
(见https://github.com/joyent/http-parser)
它是围绕高性能事件库picoev构建的。
(见http://developer.cybozu.co.jp/kazuho/2009/08/picoev-a-tiny-e.html)
发送文件
Meinheld在wgsi.file_包装器上使用sendfile(2)。