PythonMonkey
PythonMonkey copied to clipboard
aiohttp calls must support HTTP Keep-Alive
Issue type
Bug
How did you install PythonMonkey?
None
OS platform and distribution
No response
Python version (python --version
)
No response
PythonMonkey version (pip show pythonmonkey
)
No response
Bug Description
The current XHR aiohttp code does not use keep-alive https://docs.aiohttp.org/en/stable/client_reference.html#basic-api
This will be a major product deficiency when potential integrators evaluate our product and will be a definite blocker, hence we need to support it now.
This means we should re-code the aiohttp-based XHR to use the ClientSession pattern instead.
@Wes for the connectivity exchanges we see responses with: xhr:response response headers ---- access-control-allow-origin: * cache-control: no-store connection: keep-alive content-encoding: gzip content-type: text/plain; charset=UTF-8 date: Mon, 06 May 2024 17:15:32 GMT server: nginx/1.18.0 (Ubuntu) transfer-encoding: chunked Can you confirm we don't expect the socketio transport layer to support keep-alive at that level (for example HTTP)? We only use our own keep-alive as part of DCP, at the higher-level layer?
@Philippe Laporte we should definitely be using HTTP keepalive and not second-guessing SocketIO there. Particularly with the JSONP-style transport, HTTP keepalive is a significant and important optimization (that has been standard for decades). Without it, you have to setup and tear down a TCP socket for every request.
Standalone code to reproduce the issue
No response
Relevant log output or backtrace
No response
Additional info if applicable
No response
What branch of PythonMonkey were you developing on? (If applicable)
No response
Possible Hint from @wesgarland: https://docs.aiohttp.org/en/stable/client_reference.html I think all we need to do is to switch to a connection pool
We also missed this spec here: https://gitlab.com/Distributed-Compute-Protocol/dcp-client#dcp-client-api