Repository navigation
Cloudflare Vite plugin: dev startup latency spikes with remote AI binding (12s remote vs 0.5s local) #16891
Replies: 1 comment
|
Hey all, hope you're doing well! @jimmycallin thanks for the repro repo and for measuring both modes on the same machine. Those numbers made this easy to follow. @emily-shen thanks too for following up on the logging you offered. The I spent some time in the code to see where the time goes. Startup makes a few API calls one after another:
The first two go through @jimmycallin does the ~7s still show up for you on the current plugin version? It would help to know whether it's still there now that the reload fix and the new log line have landed. On the "how is time spent" part, I think I found why it's hard to see from Vite. The plugin's logger is fixed at level Maintainers, would a small PR be useful here? It would let the Vite plugin logger reach debug level (following Vite's own |

Uh oh!
There was an error while loading. Please reload this page.
Moved from #13033. Originally opened by jimmycallin on 2026-03-24.
What versions & operating system are you using?
macOS
Node 20
npm 10
Vite 8.0.2
@cloudflare/vite-plugin 1.30.0
Wrangler 4.76.0
Please provide a link to a minimal reproduction
https://github.com/jimmycallin/cloudflare-vite-startup-latency-mre
Describe the Bug
I'm seeing a large dev startup regression when running with remote bindings enabled, specifically with an AI binding configured as remote. In the same minimal repository and on the same machine, local bindings mode starts quickly, while remote mode is much slower.
Reproduction steps:
Clone the repro repository.
Run remote mode:
Run local mode:
Observed behavior:
With AI remote binding configured in wrangler.jsonc:
Local mode:
Expected behavior:
Remote mode startup should be closer to local mode startup and not exhibit an approximately order-of-magnitude increase in this minimal setup.
Please provide any relevant error logs
No response
penalosa commented on 2026-03-24:
This was likely a transient API issue, and should be resolved now. Could you try again and see if it's fixed?
jimmycallin commented on 2026-03-25:
it has improved, but the difference between with and without remote ai bindings enabled in my reproducible example is still ~6.5s (500ms vs 7000ms), which feels unnecessarily long.
also, it was initially very difficult to debug where the this delay came from - it took me down on many different paths before tracking down remote ai bindings.would be great to somehow improve transparency on how time is spent within the cloudflare plugin.
danieljvdm commented on 2026-04-11:
I can also confirm this, any remote bindings add huge startup overhead to my local dev server.
emily-shen commented on 2026-04-24:
This is only on start up right, and not on reloads? It's unavoidable that remote bindings will add latency to startup, because we have to make network calls to establish the remote connection. If you're seeing a really long lag on every server reload though that would be a bug.
We can add logging to make it clearer that its initialising the remote connection though.
jimmycallin commented on 2026-04-24:
Yes, only on startup. I understand it's unavoidable, but is ~7s reasonable latency for establishing a remote connection? Without knowing the implementation details, I would expect sub-second added latency on stable connections.
Adding logging would have saved me a lot of time digging into this, but might want to consider to have it enabled by a debug flag to avoid noise.
Thank you.
All reactions