Live data from Hacker News

Uvloop: Fast Python networking

magic.io

51–60 of 132 posts

Re: Uvloop: Fast Python networking

#51
post #16

Asyncio is pretty fast, but as soon as you write any Python logic, request per second will drop significantly. I'm surprise uvloop is faster than node.js since libuv was developed for the latter. Kudos to the author.

> Asyncio is pretty fast, but as soon as you write any Python logic, request per second will drop significantly.

Sure, but it really depends on how complex your Python code is.

> I'm surprise uvloop is faster than node.js since libuv was developed for the latter. Kudos to the author.

Thanks!

Re: Uvloop: Fast Python networking

#52
post #43

Earlier quoted context omitted.

> 2) No, they have a different architecture Having a web framework (a next generation Flask if you will) built ground up with concurrency is the missing key. I have used Flask for many years, but this is the right time to introduce a new framework - because of the internal restructuring and slowdown of Flask's maintainers (and I say this with the utmost respect). If you are keen, this has the potential to be the kill…

I'm actually thinking about writing such a framework :) I'll call it "spin".

You totally should. I think people are hungry for a next gen async web framework... And if it leverages Python 3, then so much the better. Flask cannot go here even if it wants because its core philosophy is to be WSGI compliant. You don't necessarily have to adhere to that.

Just one point, please make sure you have designed DB access as a core part of your framework (e.g. [1]). Too many frameworks discount database interaction until it's too late.

Oh and please please choose your name so that it doesn't conflict on Google search. http://www.spinframework.org

[1] http://initd.org/psycopg/docs/advanced.html#async-support vs https://github.com/chtd/psycopg2cffi

Re: Uvloop: Fast Python networking

#53
post #30

Earlier quoted context omitted.

1) I don't know :( I've answered a similar question in this thread with a couple of guesses. 2) No, they have a different architecture. Although I heard that there is a project to integrate asyncio into django to get websockets and http/2. 3) asyncio/uvloop require you to use explicit async/await. So, unfortunately, the existing networking code that isn't built for asyncio can't be reused. On the bright side, there a…

I'm the main person in Django working on 2), and this is interesting for sure, though our current code is based on Twisted since we need python 2 compatability (there's some asyncio code, but not a complete webserver yet)

What are the chances that Django Channels (the project I believe you're working on) will be able to ship with support for asyncio/uvloop?

Re: Uvloop: Fast Python networking

#54
post #2

I'm the dev behind uvloop. AMA.

No questions, just a thank you for including relevant information about the tests content, concurrency, adding percentile boxes to graphs, etc. (and the tested environment itself!) It's refreshing to see a benchmark taken seriously rather than "we tested some stuff, here are 3 numbers, victory!".

Thanks!

Re: Uvloop: Fast Python networking

#55
post #43

Earlier quoted context omitted.

I'm actually thinking about writing such a framework :) I'll call it "spin".

You totally should. I think people are hungry for a next gen async web framework... And if it leverages Python 3, then so much the better. Flask cannot go here even if it wants because its core philosophy is to be WSGI compliant. You don't necessarily have to adhere to that. Just one point, please make sure you have designed DB access as a core part of your framework (e.g. [1]). Too many frameworks discount database…

Since spin is conflicting, may I suggest spyn? Gets that nice little Python 'py' in there.

Re: Uvloop: Fast Python networking

#58
post #43

Earlier quoted context omitted.

> 2) No, they have a different architecture Having a web framework (a next generation Flask if you will) built ground up with concurrency is the missing key. I have used Flask for many years, but this is the right time to introduce a new framework - because of the internal restructuring and slowdown of Flask's maintainers (and I say this with the utmost respect). If you are keen, this has the potential to be the kill…

I'm actually thinking about writing such a framework :) I'll call it "spin".

Go for it! An async python web framework with the speed of Go and the ecosystem of python would be a killer app.

Re: Uvloop: Fast Python networking

#59
post #2

I'm the dev behind uvloop. AMA.

1) What makes uvloop which is based on libuv 2x faster than node.js which is also based on libuv? 2) Can uvloop be used with frameworks like flask or django? 3) gevent uses monkey patching to turn blocking libraries such as DB drivers non-blocking, does uvloop do anything similar? If not how does it work with blocking libraries?

You can use guv[0] if you're looking for a UV based version of gevent. I've used it before with good success.

[0] https://github.com/veegee/guv/blob/develop/README.rst

Re: Uvloop: Fast Python networking

#60
post #28

Earlier quoted context omitted.

> Building on to this, how does it compare to raw libuv in c? Building something in C is very hard. uvloop wraps all libuv primitives in Python objects which know how to manage the memory safely (i.e. not to "free" something before libuv is done with it). So development time wise, uvloop is much better. As for the performance, I guess you'd be able to squeeze another 5-15% if you write the echo server in C. > I'm not…

>So development time wise, uvloop is much better. Yeah, I definitely get that. I'm just trying to see the smaller picture here. >Cython is a statically typed compiled language, it can be anywhere from 2x to 100x faster than Python. Ah, my bad for not knowing the difference between Cython and CPython. It seems to me, then, that this isn't really a fair comparison to node, is it? Naturally a statically typed language i…

> It seems to me, then, that this isn't really a fair comparison to node, is it?

Isn't node written in C?

Post reply on HN