You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using aiohttp.web and aiomysql. Before reading the source code, I had no idea weather I should:
Keep a global cursor and use it
Keep a global connection and derive a cursor for each request
Keep a global connection pool and acquire one for each request
Since the traditional "blocking" model uses the third method, and the simple examples given does not use connection pool, I thought method 1 or 2 are also fine.
But after I read the source code, I found that connection is essentially a state machine, and cursor is a “fake” proxy to it. Reusing the same connection at the same time might cause problems. (Correct me if I'm wrong)
Describe the solution you'd like
A better documentation is deserved, especially in README.md, that highlights the importance of using connection pool in concurrent use case.
Describe alternatives you've considered
I'm not sure weather mysql supports pipelining in the same connection (like http pipelining). If it does, maybe cursors can be implemented that way to support concurrent connection reuse?
Additional context
No response
Code of Conduct
I agree to follow the aio-libs Code of Conduct
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem?
I'm using
aiohttp.web
andaiomysql
. Before reading the source code, I had no idea weather I should:cursor
and use itconnection
and derive acursor
for each requestconnection pool
and acquire one for each requestSince the traditional "blocking" model uses the third method, and the simple examples given does not use
connection pool
, I thought method 1 or 2 are also fine.But after I read the source code, I found that
connection
is essentially a state machine, andcursor
is a “fake” proxy to it. Reusing the same connection at the same time might cause problems. (Correct me if I'm wrong)Describe the solution you'd like
A better documentation is deserved, especially in README.md, that highlights the importance of using
connection pool
in concurrent use case.Describe alternatives you've considered
I'm not sure weather mysql supports pipelining in the same connection (like
http pipelining
). If it does, maybe cursors can be implemented that way to support concurrent connection reuse?Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: