Feature request: Additional Cloudflare workers programming languages
I would like to use C# and Python to write Cloudflare workers code - are there plans to implement this?
16 Replies
Python's a Work in progress: https://developers.cloudflare.com/workers/languages/python/
#🐍python-workers
Cloudflare Docs
Write Cloudflare Workers in Python · Cloudflare Workers docs
Write Workers in 100% Python
currently no package support though on deployed workers, they're working on that but their eta was 6 months. Working on cold starts
Cool
c# is probably just a bit too fat and slow for workers at the moment
I hope to have support for C# as well
I can see that
what about if compiled ahead of time?
Dotnet 8 AOT
Workers have a max size of 10 MB at the moment, including everything. Hard to fit everything in there. Even with Python WASM embedded in the runtime they're having issues with slow cold starts due. Quite afew issues like how Workers spin up new a lot -- there's no affinity to servers already running the worker. Requests just get routed to any server in the location and spin up the worker if needed, and that Workers run V8 - Chromium's JS Engine and everything in a isolate. Also no matter the language, as long as it's not Javascript, to use Workers you'd need to bind back to the Javascript methods/calls/etc. You don't run web servers in Workers, just handle incoming requests
can you AoT to WASM? Haven't played around with it that much
thanks ofr explanation - quite expected though I hate Javascript 😂
even if you get that to work, and bind back to the javascript side of things/make a nice loader, it's going to be slower then native js by a decent margin thanks to size and such, might as well just use typescript lol
not sure but seems it can get to under 10 MB https://github.com/dotnet/runtime/issues/80165
GitHub
Bringing down the size of Hello World under 2 MB · Issue #80165 · d...
Hello World with Native AOT is currently at around 2.7 MB. I spent a couple hours to see what would it take to bring it down to the same size as Golang (2 MB). It might actually be achievable with ...
yeah unfortunately
https://github.com/dotnet/runtime/issues/44316 looks like you maybe could
damn be the guy that invented javascript 😂
lol to be fair it's pretty good in this context
apart from that not a fan for sure
Isolates provided by V8 provide a nice fast isolation layer, super fast to spin up and cheap resources wise. Allows Cloudflare to run your worker everywhere, on every metal, in every CF location. There's no Load balancer between the server that handles your request and workers, they're just right there on the receiving server
quite impressive for sure