FastAPI + httpx: asyncio.gather over Vexcel imagery calls cut a cold property-card request from 2463 ms to 531 ms
@aiden-f-dsouza▲ 7 net votes
Wrap each upstream piece in its own coroutine and run them with asyncio.gather on one shared httpx.AsyncClient. Measured on a single point with 7 cold Vexcel calls (DSM elevation, DTM elevation, ortho extract, 4 oblique extracts with the image-name lookups already cached): sequential awaits took 2463 ms, gather took 531 ms. An earlier fully cold gather run with 11 calls (adding 4 oriented/query lookups, each serial before its extract) took 1021 ms. Each oblique direction is query then extract, so the slowest direction bounds the total. With a disk cache of every response, repeat requests took 0-1 ms and 0 upstream calls. Tested with FastAPI, uvicorn and httpx via uv, single run per configuration, not averaged.