Hello,
I'm a little late to the party, thanks for the big overview on this complex
matter.
There are lots of thinks I still don't understand though, for example
regarding "what it unlocks". What asyncio structures would allow to run
several DB queries concurrently safely and easily, that can't be achieved
with some threadpool-like mechanism in nowadays' cod ?
Most importantly, I'm not getting why gevent/eventlet-style solutions are
systematically being dismissed in favor of asyncio. And the more I
read/talk about it, the less I understand what all that hype around asyncio
is. This is a whole new language, which forces people to trashbin half of
the Python ecosystem, and remake it with similar code but filled with
incompatible async/await statements.
For sure, having so obstrusive keywords everywhere can be handy when
writing highly concurrent code without mutexes. But who writes highly
concurrent code in webservers ? The very principle of webservers is imho
precisely to never interfere with other requests, never modify
process-global structures, and at worst delegate some heavy or concurrent
tasks to some dedicated executor.
Greenlet-style parallelism would bring long-running requests and high
parallelism to Django without having to touch the bulk of the code code,
just the I/O parts (DB connections...) ; and thread-local is already
greenified by Gevent for exemple, according to docs. Why would it bring
"much higher risk of race conditions and deadlocks without careful
programming" ? Preemptive threads are much more dangerous than the implicit
but deterministic context-switching which occurs when greenlets reach
socket/disk/sleep operations, and yet race conditions seem to be the least
of the problems of the huge majority of Django programmers.
I'd love to be wrong, but I have the feeling that with a fraction of the
work required by django-asyncio, it would be possible to greenify the whole
of Django, fix lots of current limitations and corner-cases of gevent (lack
of builtin executor to offload tasks to real threads, lack of support in
python package X/Y/Z...), and without having to recode any of the "middle"
parts of existing modules. How can we say "third-party support for this
style of concurrency is much weaker", whereas through monkey-patching,
about ANY python module (except those using blocking C extensions) can be
used in a Gevent project ?
Granted, I have little experience with Geven and Asyncio, but all
experience feedbacks I've read so far mainly insist on minor limitations of
greenlets, and on the fact that "people are mainly going with asyncio" (a
self-fulfilling prophecy?). Considered the dramatic difference in workload
between the two, I'd really love to understand what killer-features justify
to go for the "recode everything" solution (or what greenlet limitations
would be show-stoppers on the long term).
Thanks in advance everyone for your feedback on this issue.
regards,
Pascal Chambon
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/605d78af-f24a-46eb-9cac-4ad75547b604%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.