3 ms·
> Serverless compute options can be broken down into two broad categories: > Containers as a Service (e.g. Google Cloud Run, Fly.io) > Functions as a Servic
by latchkey 5y ago
> Serverless compute options can be broken down into two broad categories:
> Containers as a Service (e.g. Google Cloud Run, Fly.io)
> Functions as a Service (e.g. Cloudflare Workers, Fastly Compute @ Edge, Suborbital)
There are also Google Cloud Functions, which is odd to not mention here.
For what I'm working on, I've put CF Workers in front of my GCF's. This allows me to terminate the SSL at the CF Worker (along with easy control of DNS) as well as control the URLs (and even content) that ends up being sent to the GCF workers as well as caching of results in CF. It gives me a huge amount of flexibility and very little complexity.
Currently doing 1m hits/day through CF workers and it is ~$6/mo + ~$20 for GCP (including a Postgres db and heavy use of pub/sub).
All the other important things are done... CI/CD for the whole development flow with Github actions doing deployments on push to main, logging and graphs comes standard. The developer experience with both GCP and CF is top notch.
Supabase continues to be an interesting alternative, but I really don't see a reason why I'd go with them.
- rvnx 5y agoThe Google Cloud Functions are not really good compared to CloudFlare Workers :/ The GCF are regioned, slow to start and behaving like an on-demand temporary cloud instance, than an actual FaaS offering.
- latchkey 5y agoUsing golang cloud functions. I have a constant stream of hits, so there are always available functions. Connecting to cloud sql postgres and serving a request that hits the database takes under 1s. Hot request/responses are ~20ms. My hits are all US based, so I plopped myself into Central. No issues there either.
- marcus_cemes 5y ago> Using golang cloud functions. I have a constant stream of hits, so there are always available functions. There is no way to avoid cold starts althogether, there will always be tail latencies unless there is a generous amount of idle instances running that GCP charges for. > under 1s. Hot request/responses are ~20ms. Those numbers are great, I think Go plays a huge part in this. Google's Node.js firestore SDK is terrible... I've had 15 second cold starts, which is unacceptable for client-facing functions, there's a whole thread about it here [1]. GCP doesn't have a very wide range of language SDK support for those that don't want to use Go or Node.js... > My hits are all US based Edge compute, like Fly.io or Cloudflare Workers truly shines when you need to serve traffic close to the user around the world. Otherwise normal region-locked functions are fine. Vercel requires you to choose a single region, and it's locked to US-east for free-tier users. For us Europeans over here, SSR has to effectively cross the Atlantic ocean. [1]: https://issuetracker.google.com/issues/158014637 https://issuetracker.google.com/issues/158014637
- latchkey 5y ago> Google's Node.js firestore SDK is terrible I don't think it is terrible, but I do agree it is a slower startup than golang by a lot. Which is why I went with golang for this project and I stopped using firebase entirely. You really don't want to effectively be parsing all your source code every time a launch happens. > Edge compute, like Fly.io or Cloudflare Workers truly shines when you need to serve traffic close to the user around the world. For my app, it is really just about having another layer of control in front of my API calls. I don't care so much about the CDN aspects.