News for hackers. Stuff that matters.
Re:ASGI from scratch – Let's build an ASGI web framework by YarickR2 on Thursday June 25, 2020 @04:22PM (#23645222)
Are there any benefits of this approach if no websockets are involved ?
Re:ASGI from scratch – Let's build an ASGI web framework by laactech on Thursday June 25, 2020 @07:18PM (#23646882)
According to some benchmarks, an ASGI framework will generally perform better than a WSGI framework [1].

Currently, the ASGI ecosystem isn't nearly as mature as the WSGI ecosystem, and for a production system, I would still prefer WSGI for now. Django just got ASGI support in 3.0, but it still has a long way to go to become fully asynchronous [2]. I think Starlette [3] will become a popular ASGI framework, but it's still early in it's development.

[1] https://www.techempower.com/benchmarks/#section=data-r19&hw=...

[2] https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/

[3] https://www.starlette.io/

Re:ASGI from scratch – Let's build an ASGI web framework by ericls on Thursday June 25, 2020 @04:39PM (#23645422)
Hi, YarickR2. I think if the whole application does not require interacting with other asyncio stuff then it's fine to stick to WSGI.

I like ASGI because it allows us to do some things (including websocket, asynchronous io, etc) much easier. And even it is not compatible with WSGI, it's not hard to wrap around a WSGI application.

The framework built in the post is far from finished or practical, please take a look at Starlette, FastAPI or even Django, etc to know more about the use cases of ASGI.

Re:ASGI from scratch – Let's build an ASGI web framework by Drdrdrq on Friday June 26, 2020 @02:16AM (#23649217)
FastAPI is awesome. The way it joins data types with input validation and automatic reference docs generation is just great. Not to mention that their own docs are pretty comprehensive.

(not affiliated, just a happy user)

Re:ASGI from scratch – Let's build an ASGI web framework by xthetrfd on Thursday June 25, 2020 @04:35PM (#23645375)
ASGI is meant to be used to enable asynchronous Python code. I guess there are many I/O bound server applications that can benefit from it.
Re:ASGI from scratch – Let's build an ASGI web framework by mrdonbrown on Thursday June 25, 2020 @05:06PM (#23645698)
It depends on the workload and app for sure, but in my experience, most of my services make a bunch of outgoing calls, usually HTTP, to different services, often in a single operation. Being able to do these in parallel, on the side, or via fork/join was pretty handy. For a simple Flask app that fronts a single db, sure, stick with wsgi, but I don't run into many apps like that anymore.
Re:ASGI from scratch – Let's build an ASGI web framework by jp_sc on Thursday June 25, 2020 @05:02PM (#23645666)
Re:ASGI from scratch – Let's build an ASGI web framework by ericls on Thursday June 25, 2020 @05:30PM (#23645951)
All of the high performing results are running with servers written in C/C++ tho.

I think if we have a more performant ASGI server / event loop, the results might be different.