Skip to content

XHR: aiohttp calls must support HTTP Keep-Alive #339

@philippedistributive

Description

@philippedistributive

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions