跳转到主要内容

高性能Python WSGI网络服务器

项目描述

这是什么

https://travis-ci.org/methane/minefield.svg

这是meinheld的分支,一个高性能的Python WSGI网络服务器。

Minefield从meinheld中移除了异步功能,并进行了一些实验性的调整。

Minefield是一个符合WSGI规范的网络服务器。(支持PEP333和PEP3333)

需求

minefield需要Python 2.x >= 2.7Python 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 (64.8 kB 查看哈希值)

上传时间

由以下支持