Fork me on GitHub
Read the Docs

Latest:

Falcon is a very fast, very minimal Python web framework for building microservices, app backends, and higher-level frameworks.

The Falcon web framework encourages the REST architectural style, meaning (among other things) that you think in terms of resources and state transitions, which map to HTTP methods.

You can find more information in the GitHub repo or in the official documentation. We also have a mailing list and IRC channel where you can ask questions and discuss ideas with the community.

Falcon is an Apache-licensed Rackspace community project, built and maintained by a group of stylish volunteers from around the world.

Instances of falcon.API are WSGI applications and can run on any WSGI server, such as Gunicorn:

$ gunicorn sample:api

Design

Falcon is a *truly* fast, light Python WSGI framework.

Light. Only the essentials are included, with six and mimeparse the only dependencies beyond the standard library. We work to keep the code lean, making Falcon easier to test, optimize, and deploy.

Fast. Cloud APIs need to turn around requests quickly, and make efficient use of hardware. Falcon processes requests several times faster than other popular web frameworks.

Flexible. Falcon can be deployed in a variety of ways, depending on your needs. The framework speaks WSGI, and works great with CPython 2.6 and 2.7, PyPy, and CPython 3.3/3.4. There's no tight coupling with any async framework, leaving you free to mix-and-match what you need for your web service.

Try the Falcon Web Framework.


Benefits

Performance. Unlike other Python web frameworks, Falcon won't bottleneck your API's performance under highly concurrent workloads. Many frameworks max out at serving simple "hello world" requests at a few thousand req/sec, while Falcon can easily serve many more on the same hardware.

Freedom. Falcon isn't very opinionated. In other words, the framework leaves a lot of decisions and implementation details to you, the API developer, which means you will need to use your head a little more than other web frameworks, and probably write a little more code. On the other hand, this gives you a lot of freedom to customize and tune your implementation in order to create a solution that stands out from the crowd.

Reliability. Falcon doesn't include a lot of cruft that is simply unnecessary when building web services. Less code and fewer dependencies means a smaller attack surface, lower memory usage, and fewer places for bugs to hide. Our build fails at anything less than 100% code coverage. We use Travis and Codecov to keep ourselves honest.


Benchmarks

Scenario. The benchmark acts as a WSGI server and performs a GET request directly on each framework's app. Each app parses a route template with a single embedded parameter, reads a query parameter and a header from the request data, sets an x-header on the response, and finally returns a 10 KiB plain-text body, randomly generated.

Method. 200,000 iterations were executed per trial, and the best time was recorded for each framework over 20 trials. The order in which the frameworks were tested was randomized for each trial. Also, garbage collection was enabled as it would be in a production environment, and a full collection was forcefully triggered before each trial. Finally, results were calculated using the Decimal class, and rounded to the nearest whole number.

Platform. Benchmarks were executed on a Rackspace Cloud Server (1 GB Performance), running Arch 2014.8 (PVHVM) with all system packages updated to their latest versions as of May 2015. The frameworks were tested on several different versions of Python. Note that in these tests the Falcon modules were not cythonized; generally speaking, the reader may expect a ~10% boost in performance when Falcon is installed with Cython.

CPython 2.7.9

Framework req/sec μs/req Performance
Falcon (0.3.0) 21,858 46 8x
Bottle (0.12.8) 12,583 79 4x
Werkzeug (0.10.4) 4,708 212 2x
Pecan (0.8.3) 3,442 291 1x
Flask (0.10.1) 2,837 352 1x

CPython 3.4.3

Framework req/sec μs/req Performance
Falcon (0.3.0) 19,514 51 7x
Bottle (0.12.8) 10,748 93 4x
Werkzeug (0.10.4) 4,968 201 2x
Flask (0.10.1) 2,961 338 1x
Pecan (0.8.3) 2,763 362 1x

PyPy 2.5.1

Framework req/sec μs/req Performance
Falcon (0.3.0) 256,417 4 27x
Bottle (0.12.8) 145,411 7 15x
Werkzeug (0.10.4) 44,276 23 5x
Pecan (0.8.3) 16,031 62 2x
Flask (0.10.1) 9,471 106 1x

 

Extended Test. Falcon was also benchmarked under CPython 2.7.9 with a more realistic scenario, in which the routing table had multiple entries, the query string contained percent-encoded characters, and several complex response headers were set in the response. Note that even when Falcon is doing more work, it still is able to outperform other frameworks, such as Bottle, which are only doing the bare minimum to construct a response.

Framework Test req/sec μs/req Performance
Falcon (0.3.0) Extended 14,384 70 5x
Bottle (0.12.8) Simple 12,583 79 4x
Flask (0.10.1) Simple 2,837 352 1x