Live data from Hacker News

Write Fast Apps Using Async Python 3.6 and Redis

eng.paxos.com

11–20 of 134 posts

Re: Write Fast Apps Using Async Python 3.6 and Redis

#11
post #3

We've just recently started using Sanic[0] paired with Redis to great effect for a very high throughput web service. It also uses Python 3 asyncio/uvloop at its core. So far very happy with it. [0] https://github.com/channelcat/sanic

Been doing the same thing: Sanic is great!

Re: Write Fast Apps Using Async Python 3.6 and Redis

#16

Ouch: https://github.com/paxos-bankchain/pastey/blob/master/app.py...

To their defense, it seems to be an app that demonstrates usage of the library. Also seems to used for benchmarking. That would explain why the Redis database can be easily flushed through a simple URL.

Re: Write Fast Apps Using Async Python 3.6 and Redis

#17
post #3

We've just recently started using Sanic[0] paired with Redis to great effect for a very high throughput web service. It also uses Python 3 asyncio/uvloop at its core. So far very happy with it. [0] https://github.com/channelcat/sanic

I have never found a good example of a Python web server that provides some mechanism for statefulness. Is it just fundamentally not possible to have shared state among requests handled by the threads of a process? Sanic's examples seem to be the same as Flask's: self-contained function calls attached to endpoints.

I keep hitting a wall with Python when I want to do something like:

1. subscribe to a websocket connection and keep the last received message in state 2. expose an http endpoint to let a client GET that last message.

Re: Write Fast Apps Using Async Python 3.6 and Redis

#20
post #3

We've just recently started using Sanic[0] paired with Redis to great effect for a very high throughput web service. It also uses Python 3 asyncio/uvloop at its core. So far very happy with it. [0] https://github.com/channelcat/sanic

I have never found a good example of a Python web server that provides some mechanism for statefulness. Is it just fundamentally not possible to have shared state among requests handled by the threads of a process? Sanic's examples seem to be the same as Flask's: self-contained function calls attached to endpoints. I keep hitting a wall with Python when I want to do something like: 1. subscribe to a websocket connect…

You can use caching to mimic this behaviour in Flask, I.e.

http://flask.pocoo.org/docs/0.12/patterns/caching/

I'm not sure how this works with multiple threads though, I imagine you would have to synchronize it yourself.

Post reply on HN