Running on Cloudflare Workers? #4418
-
Does any know about the feasibility of this? Ganache runs in the browser so it appears to be technically possible. Is there anything preventing Ganache from running in the service worker-like context of Cloudflare Workers? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I've done it, however the cold starts were a problem, as workers must load the ganache code from scratch every time, and this sometimes exceeded the amount of time workers are given to start up. From Cloudflare docs:
But if you lazy load ganache (inside the worker handler) it still has problems because of CPU time limits:
If Ganache can't be parsed and evaluate by Workers within 200ms we certainly won't be able to do it in 10ms! So this means you'd need use the paid plan just because ganache is so big right now. I think the issue is that we ship all of Ganache in a single file: https://cdn.jsdelivr.net/npm/[email protected]/dist/web/ganache.min.js. If instead, we adeduplicated some of the dependencies that end up in the bundle (I think bn.js gets in there a bunch of times) and/or split it into smaller parts that could each be lazy-loaded when needed, it could work. |
Beta Was this translation helpful? Give feedback.
I've done it, however the cold starts were a problem, as workers must load the ganache code from scratch every time, and this sometimes exceeded the amount of time workers are given to start up.
From Cloudflare docs:
But if you lazy load ganache (inside the worker handler) it still has problems because of CPU time limits:
If Ganache can't be parsed and evaluate by Workers within 200ms we certainly won't be able to do it in 10ms!
So this means you'd need use the paid pl…