psycogreen, gevent, eventlet, psycopg2 and django async orm #9
allen-munsch
started this conversation in
Ideas
Replies: 2 comments
-
Oh I can see we pretty much addressing the same question as I did in #7 (comment) so let me just look deeply into this and I'll give you my feedback. Thank you for sharing your research ! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Aye, from Andrew Godwin django/asgiref#264 Looks like there's some hang ups on getting this to work. I don't really have the bandwidth or in-depth knowledge to get it hacked together. A branch where I tried a drop-in replacement of the default sync_to_async executor #7 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Trying to determine what all is happening where, I'm just writing a summary of my research here.
What exactly is happening when django is using monkey patched code, and other parts of the code is using ASGI, and async.
WSGI mounted in ASGI
ASGI mounted in WSGI
And more specifically, what about using eventlet / gevent and a monkey patched psycopg2?
psycopg2 reaches out to psycogreen.
psycogreen does a conn.poll(), and depending on the state waits on a read/write, or fails out
simply:
What does
psycopg2.extensions.set_wait_callback
do?So what does
wait_read
, andwait_write
do?Okay, so what about using
sync_to_async
? How does that factor in here?sync_to_async
takes up to 3 argsWith some thread sensitivity, and what not eventually it gets to:
According to https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_in_executor
sync_to_async
uses a :How does the
concurrent.futures.ThreadPoolExecutor
work, and or differ from thegevent.threadpool.ThreadPoolExecutor
?Curious ... does that mean
wait_read
, andwait_write
as well?So given all this information what is the summary?
Feedback?
an untested branch : #7
Beta Was this translation helpful? Give feedback.
All reactions