All Projects → mopemope → Meinheld

mopemope / Meinheld

Licence: other
Meinheld is a high performance asynchronous WSGI Web Server (based on picoev)

Programming Languages

python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Meinheld

Falcon
A high-performance web server for Ruby, supporting HTTP/1, HTTP/2 and TLS.
Stars: ✭ 2,058 (+53.7%)
Mutual labels:  async, http-server
Http Kit
http-kit is a minimalist, event-driven, high-performance Clojure HTTP server/client library with WebSocket and asynchronous support
Stars: ✭ 2,234 (+66.84%)
Mutual labels:  async, http-server
Nasus
Zero-configuration command-line async HTTP files server in Clojure. Like Python's SimpleHTTPServer but scalable.
Stars: ✭ 158 (-88.2%)
Mutual labels:  async, http-server
Aiohttp
Asynchronous HTTP client/server framework for asyncio and Python
Stars: ✭ 11,972 (+794.1%)
Mutual labels:  async, http-server
Http static
File serving using tower web
Stars: ✭ 18 (-98.66%)
Mutual labels:  async, http-server
Swoole Bundle
Symfony Swoole Bundle
Stars: ✭ 201 (-84.99%)
Mutual labels:  async, http-server
Igropyr
a async http server base on libuv for Chez Scheme
Stars: ✭ 85 (-93.65%)
Mutual labels:  async, http-server
Http Server
A non-blocking HTTP application server for PHP based on Amp.
Stars: ✭ 1,122 (-16.21%)
Mutual labels:  async, http-server
Netcoreserver
Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
Stars: ✭ 799 (-40.33%)
Mutual labels:  async, http-server
Cppserver
Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
Stars: ✭ 528 (-60.57%)
Mutual labels:  async, http-server
Chili
Chili: HTTP Served Hot
Stars: ✭ 7 (-99.48%)
Mutual labels:  async, http-server
Suave
Suave is a simple web development F# library providing a lightweight web server and a set of combinators to manipulate route flow and task composition.
Stars: ✭ 1,196 (-10.68%)
Mutual labels:  async, http-server
Ctrlsf.vim
An ack.vim alternative mimics Ctrl-Shift-F on Sublime Text 2
Stars: ✭ 1,283 (-4.18%)
Mutual labels:  async
Proxy.py
⚡⚡⚡Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging
Stars: ✭ 1,291 (-3.58%)
Mutual labels:  http-server
Datakernel
Alternative Java platform, built from the ground up - with its own async I/O core and DI. Ultra high-performance, simple and minimalistic - redefines server-side programming, web-development and highload!
Stars: ✭ 87 (-93.5%)
Mutual labels:  async
Tinyhttp
🦄 0-legacy, tiny & fast web framework as a replacement of Express
Stars: ✭ 1,259 (-5.97%)
Mutual labels:  http-server
Event Store Client
PHP 7.4 Event Store Client Implementation
Stars: ✭ 93 (-93.05%)
Mutual labels:  async
Taskorama
⚙ A Task/Future data type for JavaScript
Stars: ✭ 90 (-93.28%)
Mutual labels:  async
Async Retry
Retrying made simple, easy and async
Stars: ✭ 1,262 (-5.75%)
Mutual labels:  async
Branchy
🍃 Execute a Node.js function in a separate process
Stars: ✭ 84 (-93.73%)
Mutual labels:  async

What's this

.. image:: https://travis-ci.org/mopemope/meinheld.svg :target: https://travis-ci.org/mopemope/meinheld

This is a high performance python wsgi web server.

And Meinheld is a WSGI compliant web server. (PEP333 and PEP3333 supported)

You can also join us in meinheld mailing list_.

Requirements

Meinheld requires Python 2.x >= 2.6 or Python 3.x >= 3.5 . and greenlet >= 0.4.5.

Meinheld supports Linux, FreeBSD, and macOS.

Installation

Install from pypi::

$ pip install -U meinheld

Install from source::

$ python setup.py install

Meinheld also supports working as a gunicorn worker.

To install gunicorn::

$ pip install -U gunicorn

Basic Usage

simple wsgi app:

.. code:: python

from meinheld import server

def hello_world(environ, start_response):
    status = b'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)

with gunicorn. user worker class "egg:meinheld#gunicorn_worker" or "meinheld.gmeinheld.MeinheldWorker"::

$ gunicorn --workers=2 --worker-class="egg:meinheld#gunicorn_worker" gunicorn_test:app

Continuation

NOTE: This feature is deprecated and will be removed in 2.0

Meinheld provides a simple continuation API (based on greenlet).

To enable continuations, use ContinuationMiddleware. get Continuation from wsgi environ.

Continuation objects have two very interesting methods, suspend and resume.

For example:

.. code:: python

from meinheld import server
from meinheld import middleware

def app(environ, start_response):
    ...

    #get Continuation
    c = environ.get(middleware.CONTINUATION_KEY, None)

    ...

    if condtion:
        waiters.append(c)
        #suspend
        c.suspend()
    else:
        for c in waiters:
            # resume suspend function
            c.resume()

    ...


server.listen(("0.0.0.0", 8000))
server.run(middleware.ContinuationMiddleware(hello_world))

For more info see http://github.com/mopemope/meinheld/tree/master/example/chat/

Websocket

NOTE: This feature is deprecated and will be removed in 2.0

Meinheld support Websockets. use WebSocketMiddleware.

For example:

.. code:: python

from flask import Flask, render_template, request
from meinheld import server, middleware

SECRET_KEY = 'development key'
DEBUG=True

app = Flask(__name__)
app.config.from_object(__name__)


participants = set()


@app.route('/')
def index():
    return render_template('websocket_chat.html')

@app.route('/chat')
def chat():
    print request.environ
    ws = request.environ.get('wsgi.websocket')
    participants.add(ws)
    try:
        while True:
            print "ws.wait()..."
            m = ws.wait()
            print "recv msg %s" % m
            if m is None:
                break
            for p in participants:
                print "send message %s" % m
                p.send(m)
    finally:
        participants.remove(ws)
    return ""


if __name__ == "__main__":
    server.listen(("0.0.0.0", 8000))
    server.run(middleware.WebSocketMiddleware(app))

Patching

NOTE: This feature is deprecated and will be removed in 2.0

Meinheld provides a few monkeypatches.

Socket

This patch replaces the standard socket module.

For Example:

.. code:: python

from meinheld import patch
patch.patch_all()

For more info see http://github.com/mopemope/meinheld/tree/master/example/patch/

Performance

For parsing HTTP requests, Meinheld uses Ryan Dahl's http-parser library.

(see https://github.com/joyent/http-parser)

It is built around the high performance event library picoev.

(see http://developer.cybozu.co.jp/kazuho/2009/08/picoev-a-tiny-e.html)

Sendfile

Meinheld uses sendfile(2), over wgsi.file_wrapper.

.. _meinheld mailing list: http://groups.google.com/group/meinheld

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].