Clarification regarding response time metrics
When i execute a query in D1 console, i see that the response time says ~ 1.5s and the query time is ~150ms
I was under the impression that the latency shouldn't be severe as it places it at a location which is close to my region, but a traveltime of ~1.35s is extreme. Is this a thing with the console or would this be the performance in aplications as well?
2 Replies
D1 Console/API/Wrangler all go to the API (which lives only in Core), and then to your D1 Instance. If you used a location hint of Oceanic/Australia for example, you might end up going
You (Sydney) -> Core (just West Coast US, could be EU one included too) -> D1 (somewhere in the oceanic region, either Australia or New Zealand) and all the way back.
If you go from a worker, in a perfect world you could go
You (Sydney) -> Worker (Sydney) -> D1 (somewhere in oceanic region)
(Worker execution location depends on the CF edge you hit, sometimes espec in specific locations like Germany/Asia Pacific region you may get routed to a further away location then you'd hope on free plan, that's it's own topic though, key point is you don't need to travel to core unlike the api)
Smart Placement can be enabled to place/run the worker near the D1 Instance as well, which can help a fair bit espec if you're making lots of queries
You said your query time is 150 ms? That seems pretty excessive on its own though, must be a really inefficient query unless you misread 0.150ms
(yes i did misread)
And thanks a ton for the elaborate clarification, we ended up adopting D1 and incrementally moving our logic to workers already! our cron costs have gone down by an order of magnitude as we were being charged per ms cpu useage earlier as well, but over here it just executes so fast. and thanks to you now i understand why!