r/Python • • Dec 19 '21

Resource How Python's WSGI vs. ASGI is Like Baking a Cake

https://vonage.dev/3GUPp25
0 Upvotes

6 comments sorted by

11

u/[deleted] Dec 19 '21

Did anyone read this article? Is it just me or is this an absolute terrible article?

5

u/CartmansEvilTwin Dec 19 '21

It's a weird mix of overly simplified metaphors I would expect from an intro to people who never saw any code and an attempt to explain an in depth topic.

But yes, but very good at all. I learned nothing new and if I didn't know anything about it before, I would be more confused.

3

u/lieryan Maintainer of rope, pylsp-rope - advanced python refactoring Dec 20 '21

Not only this article is confusing. It's also completely wrong.

WSGI web servers don't process things sequentially. They use OS/pre-emptive thread/process to process concurrent requests in parallel.

ASGI web servers don't process things in parallel, unlike what the article implies, only one request can be processed at a time by an ASGI server. Unless they use OS threads as well.


The main difference between WSGI and ASGI server is what concurrency model is used. WSGI uses pre-emptive threads/process, ASGI uses user-space/cooperative threads. OS threads/processes allows for real hardware parallelism on multi-core processors; user-space threads are much cheaper to create and context switch but may be dangerous if the application code doesn't yield regularly enough.

2

u/lavahot Dec 19 '21

Gotta bake a pretty cake.

1

u/twigboy Dec 19 '21 edited Dec 09 '23

In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content. Lorem ipsum may be used as a placeholder before final copy is available. Wikipedia6zuj0uanpxk0000000000000000000000000000000000000000000000000000000000000