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
Chaika
Chaika5mo ago
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
Chaika
Chaika5mo ago
currently no package support though on deployed workers, they're working on that but their eta was 6 months. Working on cold starts
Casper
CasperOP5mo ago
Cool
Chaika
Chaika5mo ago
c# is probably just a bit too fat and slow for workers at the moment
Casper
CasperOP5mo ago
I hope to have support for C# as well I can see that what about if compiled ahead of time? Dotnet 8 AOT
Chaika
Chaika5mo ago
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
Casper
CasperOP5mo ago
thanks ofr explanation - quite expected though I hate Javascript 😂
Chaika
Chaika5mo ago
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
Casper
CasperOP5mo ago
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 ...
Casper
CasperOP5mo ago
yeah unfortunately
Chaika
Chaika5mo ago
Casper
CasperOP5mo ago
damn be the guy that invented javascript 😂
Chaika
Chaika5mo ago
lol to be fair it's pretty good in this context
Casper
CasperOP5mo ago
apart from that not a fan for sure
Chaika
Chaika5mo ago
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
Casper
CasperOP5mo ago
quite impressive for sure
Want results from more Discord servers?
Add your server