Worker Latency Variability

When using workers with Hasura, we notice some variability of the overall request latency.

Some requests are 200ms, then the same request can be 600ms. Hitting worker without it is 30ms. And round trip to Hasura tested separately is 30ms.

Understanding a cold start is not the cause, we are loading quite a bit of code into the isolate from graphql-codegen. Although it shouldn’t be nearly that much of a difference, and it occurs even after the isolate loads.

Is there some configuration setting or quick fix/hack anyone has discovered to overcome this when making fetch requests to other resources? Best guess we have is the handshake with the Hasura server but it shouldn’t be that long.

Tests have been with autocannon and from Insomnia from a few different regions. Both worker and hasura individually are consistently fast but combined it can be upwards of 10x more than adding ones latency to the other.

Having worked with stuff like this for a few years, I’m baffled at what conceptually could be the cause…