Code Monkey home page Code Monkey logo

restart-falcon's Introduction

RESTArt-Falcon

A RESTArt extension for integrating RESTArt into Falcon, which has the benefit of high performance.

Why

Pros: With RESTArt-Falcon, you can benefit from the high performance of Falcon, while still using the RESTArt-style API code, which I think is more Pythonic.

Cons: The Werkzeug-style converters (with the separator :) is not supported in RESTArt-Falcon. Captured parameters in URI can only be specified in the form of <arg>, which will be automatically converted to Falcon-style {arg}.

Installation

Install RESTArt-Falcon with pip:

$ pip install RESTArt-Falcon

Install development version from GitHub:

$ git clone https://github.com/RussellLuo/restart-falcon.git
$ cd restart-falcon
$ python setup.py install

Benchmarks

Codebase

The pure RESTArt API:

from restart.api import RESTArt
from restart.resource import Resource
from restart.serving import Service

api = RESTArt()

@api.route(methods=['GET'])
class Action(Resource):
    name = 'action'

    def read(self, request):
        return 'Go'

app = Service(api)

The RESTArt-Falcon API:

from restart.api import RESTArt
from restart.resource import Resource
from restart.serving import Service
from restart.ext.falcon.adapter import FalconAdapter

api = RESTArt()

@api.route(methods=['GET'])
class Action(Resource):
    name = 'action'

    def read(self, request):
        return 'Go'

app = Service(api, FalconAdapter)

The pure Falcon API:

import falcon

class Action(object):

    def on_get(self, req, resp):
        resp.status = falcon.HTTP_200
        resp.body = 'Go'

app = falcon.API()
app.add_route('/action', Action())

Scenario

OS CPU Memory Gunicorn Benchmark Command
Ubuntu 14.04 4 cores 8 G 8 workers http_load -p 100 -s 10 [url_file]

Result

Framework (or Library) reqs/s us/req
RESTArt 2893 345
RESTArt-Falcon 4020 248
Falcon 6310 158

restart-falcon's People

Contributors

russellluo avatar

Stargazers

Scott Sharkey avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.