TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Build your own FaaS: Self-host workers, lambda, JavaScript functions

45 pointsby giuseppeltalmost 2 years ago

3 comments

jamesmcintyrealmost 2 years ago
This is awesome! I&#x27;m working on a project that will heavily utilize FaaS and I&#x27;ve explored many options. Your combination of &quot;secure and configure via workerd&quot; with &quot;autoscale and orchestrate with fly.io&quot; is really great!<p>I know it&#x27;s a POC but just some of my thought&#x27;s &#x2F; questions to see if you have any ideas or opinions on them:<p>- I briefly browsed workerd repo and it doesn&#x27;t seem like there&#x27;s an api to load a new worker script file to the existing workerd instance. Which is, i&#x27;m guessing, one reason why you&#x27;re just restarting the whole fly machine to re-fetch the latest zipped resources at boot. - workerd repo mentions it&#x27;s currently single-threaded - i&#x27;m wondering how fast workerd itself boots? - due to ^ those three points I&#x27;m wondering if a nice design would be: - publisher &amp; worker use bullmq and it&#x27;s sandbox-worker to spawn child process workers running workerd (helps utilize more threads &amp; the bullmq worker code can take the job data input which contains the new user script to bootstrap config at job run). This would be good IF workerd boots fast.. - if workerd doesn&#x27;t boot fast, and eventually you have many user scripts i can&#x27;t see any other option than to have a third server that acts as a load-balancer&#x2F;orchestrator. It would keep state of user scripts and which worker fly machines have told it it can run that script. Could still use a &quot;buffer worker machine&quot; which can &quot;cold-boot&quot; newly published scripts using the bullmq method i mentioned above.<p>Anyway, this is all really cool just wanted to spitball some ideas!
评论 #36699274 未加载
giuseppeltalmost 2 years ago
Hi, this is more an experiment that a real production-tested project. You can create your own Function as a Service architecture, and self-host everywhere you want.<p>It leverages workerd, the Cloudflare worker runtime. And as deploy tutorial, it include a guide to host everything on Fly.<p>It support container-based deployment, so docker is your friend here.<p>The complete project is on: <a href="https:&#x2F;&#x2F;github.com&#x2F;giuseppelt&#x2F;self-workerd">https:&#x2F;&#x2F;github.com&#x2F;giuseppelt&#x2F;self-workerd</a><p>Mind this a proof-of-concept, public exposed systems require more work.
prakisalmost 2 years ago
This looks great.
评论 #36696227 未加载