My usual response time is <50ms. Here's my tech:
- Web Server: FastAPI+uvicorn
- Proxy: nginx
- DB: Postgres on VM
- DB API: sqlalchemy+pg8000
There are two docker containers (~1GB) running on the VM.
However, the request wouldn't reach the server, and would timeout with 404 with the following exception (not reproducible):
sqlalchemy.exc.InterfaceError: (pg8000.exceptions.InterfaceError) network error
All servers are Azure D series VMs and in the same VNET.
I've had this issue previously, which I was able to solve by having only one docker on that VM. However, in this case both images are lightweight.
There was a recent bug fix in pg8000 version 1.29.5 that may fix the problem you're seeing. Looking at the release notes the relevant bit is:
and the commit itself may be helpful.