高性能Python WSGI网络服务器
项目描述
这是什么
这是meinheld的分支,一个高性能的Python WSGI网络服务器。
Minefield从meinheld中移除了异步功能,并进行了一些实验性的调整。
Minefield是一个符合WSGI规范的网络服务器。(支持PEP333和PEP3333)
需求
minefield需要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
minefield支持gunicorn。
要安装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)
使用gunicorn。用户工作类为“egg:minefield#gunicorn_worker”或“minefield.gminefield.MinefieldWorker”
$ gunicorn --workers=2 --worker-class="egg:minefield#gunicorn_worker" gunicorn_test:app
性能
对于解析HTTP请求,meinheld使用Ryan Dahl的http-parser库。
(见https://github.com/joyent/http-parser)
它基于高性能事件库picoev构建。
(见http://developer.cybozu.co.jp/kazuho/2009/08/picoev-a-tiny-e.html)
sendfile
Meinheld使用sendfile(2),通过wgsi.file_wrapper。
项目详情
关闭
minefield-0.6.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 72ac0d3f867aecaf2a0421c678187c116840868aed764da1e54ba0258a934603 |
|
MD5 | f0f4f8b119c1ac8a53dcda3ad1aa8970 |
|
BLAKE2b-256 | bd560dcc62f22bd118cabdc795b0300cde4a2c61665d75d1aa969070d5b4fa68 |