2 ms·
It's hard to say what's going on here since we haven't seen code or config, but from what I can tell, this almost certainly has nothing to do with JSON renderin
by kentonv 4y ago
It's hard to say what's going on here since we haven't seen code or config, but from what I can tell, this almost certainly has nothing to do with JSON rendering and everything to do with network positioning.
The app in question apparently makes 250 API calls to the HN API:
https://twitter.com/ericlewis/status/1632397105179287552 https://twitter.com/ericlewis/status/1632397105179287552
The "benchmark" is measuring latency of the whole thing:
https://twitter.com/ericlewis/status/1632395158938345473 https://twitter.com/ericlewis/status/1632395158938345473
What's almost certainly happening here is Fly is running the app closer to the API server, whereas Cloudflare runs the Worker in the closest datacenter to the client. Normally running close to the end user is great, but when the app makes tons of API requests, it's not great.
This turns out to be something we're actively working to improve in Workers.
(I'm the tech lead for Cloudflare Workers.)