Hacker News new | ask | show | jobs
by solardev 968 days ago
I wonder why they went with AWS Lambda and PHP instead of something serverless-native like Cloudflare Workers? I guess they still have some critical parts of the legacy stack on AWS (DBs especially, but also other AWS services).

I wonder if you can build something like this entirely greenfield today, like what you'd use as a permanent data store for all the transactions, without having to manage the scaling of each individual microservice. Would CF Workers + Durable Objects be able to handle something like that?

2 comments

DynamoDB as a data store for transactions works just fine, as long as you are aware of the trade-offs and design a good data model.
Sorry, I didn't mean that as a challenge to AWS, just wondering what the pros/cons/tradeoffs are to each approach.
Also, I just realized "Bref" is its own project that lets you run PHP on serverless Lambdas... like a Google Cloud Run on Amazon?

Is this really such a big niche? It's weird to me to you'd want to use PHP for something like this (and I love PHP, it just doesn't strike me as the best tool for serverless).

PHP is great for serverless because its execution model is compatible with it.

Unlike Node, Python, Java, etc. that start a long-lived server, each request is handled by PHP in a separate process.

That's what makes it really to use with serverless (and lift-and-shift, like what Treezor did).

Does that really matter when JS can be isolated in V8?

Comparing Bref (https://bref.sh/docs#maturity-matrix) which inherits Lambda's 200ms+ cold starts vs Cloudflare's 5ms (https://blog.cloudflare.com/eliminating-cold-starts-with-clo...), for example, is a pretty big difference.

But I guess if performance isn't a critical use (or you just have so many invocations all the time in every data center that cold start isn't an issue), it's nice to be able to ~port~ copy and paste over your existing PHP code.

As you can see on the website (https://bref.sh/) there's 13 billion monthly AWS Lambda invocations using Bref (PHP).
That doesn't really say much. Isn't the whole point of serverless to support high-volume, individually-inexpensive, invocations?

For context, 13B is like roughly a <strike>$2000</strike> (edit: more like $4000, sorry) spend on Cloudflare Workers, similar cost (harder to calculate but ballpark similar) on Lambda. That could be a single company spending the bulk of that.

(Further edit: Lambda pricing is way off too. See reply below.)

That ballpark is not even close to the park. My company spends ~$500/month on AWS Lambda and we're doing about 2M/req/day with Bref. There's still 12B 940M requests to account for
Thank you, and sorry about that!

How come Lambda is so expensive for you?

At 13000M invocations/mo, that's $2600 in requests. Is it the GB-seconds duration charge that get you?

The GB-second is the relevant cost of AWS Lambda. # of invocations is pretty irrelevant.

60'000'000 requests

1536MB RAM

300ms response avg

(calculation includes free tier):

Request costs: $11.80/month

Execution costs: $443.42/month

Total AWS Lambda costs: $455.22/month