Brian Lovin
/
Hacker News
Daily Digest email

Get the top HN stories in your inbox every day.

willsmith72

I always love a story about a successful strangler pattern migration.

I do wonder how they came to Lambda though. I love it for small workloads and highly variable demand services, but something like Treezor you'd think has relatively flat and high demand. The cloud cost for Lambda would be much higher than running the equivalent compute, even with something also highly scalable like ECS.

ceejayoz

We use Lambda (via Laravel Vapor; https://vapor.laravel.com/) for a big analytics batch processing job every night; it spawns hundreds of thousands of individual jobs that make various API calls, but only for a few minutes. For the rest of the day it's doing very little.

I'd imagine a bank has quite a few of these sorts of bursty bash processing needs; ACHes, end-of-day reconciliation, etc.

ndriscoll

At my last job, we had an architecture that ran hundreds of thousands of individual jobs with internal API calls for nightly account updates and reporting work, and it was a major battle to finally get it replaced with some simple SQL scripts which ran orders of magnitude faster while being a lot more reliable.

As I understand it, banking commonly uses JVM where you can easily do async or multithreaded processing and task scheduling, so lambda doesn't offer much over ECS, and the timeout could be a real killer.

jackconsidine

What's your experience with Vapor? We played around with it and thought about switching from Forge, but it was too complicated for our codebase. I love the idea though.

How expensive our your cloud costs? CI/CD pretty good?

ceejayoz

Overall quite good. We use their Docker container support (to get ffmpeg, mostly) and it's been pretty smooth running throughout. I'd previously used a lot of Heroku so the habits developed there paid off in our codebase for Vapor; only a few tweaks were really needed.

Cost-wise we're pretty bursty, so it's saved us quite a bit. Lambda runtime is money, so a little bit of performance optimization can go a long way. CI we run through Github Actions; an environment secret plus `vapor deploy` and it's on its way up after a successful run.

Wasn't a fan of Forge; for that style of things I'd use Ploi nowadays.

theshrike79

Lambdas are amazing at clearing queues.

You can have a single queue gathering workloads and then have Lambda functions grab a bunch of tasks, handle them, grab more etc. until the max runtime is met and they're automatically rebooted.

It's also pretty trivial to add more processing capacity when the queue goes over a specified limit just by allowing for more concurrent Lambdas.

And when there's nothing to process, you've got one idling Lambda doing nothing and costing nothing.

me_graf

I did some fintech work as a junior / kinda non junior dev. This is correct. I think 90% of the work was taking pictures of checks, and setting up batch jobs. all batch: - money movement (between accounts) - transfers - wires - etc.

even the 'non' batch things were done in batch (even if it's do now, and only 1).

iLoveOncall

> I do wonder how they came to Lambda though

Probably misplaced hype about being fully serverless.

As you said, ECS would be much more suitable while also addressing the issue that they had (spikes in traffic).

Lambdas behind API Gateway sounds like a good idea and even looks like one if you don't have experience with ECS and don't do a proper cost comparison analysis.

My team uses ECS' autoscaling to scale up to tens (or even hundreds) of thousands of tasks in minutes without issues.

Supermancho

> I do wonder how they came to Lambda though.

Probably some security certification that AWS Lambda comes with. I worked at Cambia Health that used Lambda (Javascript) for dealing with customer mobile data. It was a nightmare solution (cost and complexity) for what should have been a simple fan out queue and process system. They hired me to help fix it. Every other solution was a flat no. AWS Lambda was was HIPPA compliant (for whatever that's worth) and some other security assurances that I don't remember, so I was basically just another developer (with a moron for a manager).

mnapoli

Their clients have very variable traffic patterns because they are in very different industries. They have traffic spikes at lunch, or at the end of every month for example:

> infrastructure must be able to scale and be resilient to accommodate various usage patterns. Whether it's a luncheon voucher transaction spike at lunchtime or a monthly batch of transactions by corporate clients

cogman10

This was my thought. Lambda works well for infrequent tasks. But hosting an API? That seems like it could get expensive pretty fast.

deleugpn

It's cheaper than most options where you need to pay a human to manage something with the same level of scalability and security that AWS provides.

ndriscoll

Lambda scalability for an API is awful; it can't run concurrent requests (of course PHP largely can't do this either). An ECS service with pretty much any other language (for async/multithreaded runtimes) will scale far better.

WatchDog

ECS fargate is pretty easy to scale, and much more cost effective.

I personally don’t think running on EC2 is particularly difficult to manage, and it’s even cheaper again.

Sohcahtoa82

Lambda is $0.0000166667 for every GB-second, which works out to ~$43.20 for 30 days. For a little more ($49/month), you could get a c6g.large and get two dedicated CPU cores (ie, not the shared burstable t2/t3) and 4 GB of RAM.

So yes, very expensive fast if you get much traffic at all. That c6g.large should easily be able to handle dozens (if not hundreds) of requests in parallel, especially if many of those requests are going to have to wait for results from a database.

If you have more than ~800 hours of Lambda execution time per month (30 days being 720 hours), then you're better off with the c6g.large. The only reason to choose the Lambda is if your traffic is extremely bursty and the c6g.large can't handle the load.

Of course, this is all assuming you're using a 1 GB Lambda. Likely, your Lambda needs less, in which case the amount of traffic needed to make the EC2 more worthwhile higher.

deleugpn

Then your EC2 instance suddenly stops working and your downtime cost you a fat contract that makes the cost of serverless a pocket change.

If you want to compare AWS Lambda with EC2, you need to bring in AWS Load Balancer, Auto Scaling, Security Upgrades for the OS, Healthcheck and many more.

Yes, Lambda is not needed in a lot of context, but if you have the expertise to use it and you want to provide enterprise-grade compliance, it's a walk in the park.

ndriscoll

2 cores and 4GB RAM should have no problem handling thousands or tens of thousands of concurrent requests on the JVM. Lambda's documented concurrency maximum is "tens of thousands"[0], which means an 8GB m6g.large or ECS instance can probably handle larger bursts than lambda can. If you had extreme bursts, you'd also be having almost every request hit a cold start.

[0] https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-...

pfych

I've been working with Lambda across a few large projects for their API's, with each endpoint being its own lambda.

This has been scaling really well for us and affordability wise it makes the development and testing phase basically free, with the final deployed costs almost never exceeding double digits monthly. This is for multi-az + multi-region deployments too.

tomrod

I'd be more worried about decimal data types being interpreted as floats. That could get gnarly fast on the wrong language runtime, and is partially why Cobol programmers are still in demand in the financial sector.

chx

the beauty of bref is you work with the same php engine as before. I am a (very) long time PHP developer, my primary work is still Drupal so the ability to make a small serverless app in PHP was very handy for me. My app implements a webhook and I feel Lambda is made for this: the script is small and quite fast, it checks the payload and puts an item into SQS as appropriate. Then another infra can slowly empty the SQS queue. The problem here is the load is insanely spikey -- sometimes tens of thousands of requests in a very short time frame, sometimes nothing. Directly writing this into a transactional database would require very costly infra. The Lambda-SQS model smooths it out. It's fine if some changes take minutes or even hours to be recorded.

joshstrange

I'd really like to play with Bref but it more or less requires using serverless framework from what I understand as there are no guides on how to get it working with something like SST. I've used serverless framework before and I won't touch it again. It seems like a complete dead end with the team behind it more or less giving up on it to go work on a cloud backend alternative to lambda/etc. Docs were a mess, lot's of half-implemented things, etc.

I wouldn't lift-and-shift the PHP app I work on, it requires too many FreeBSD-specific/custom underlying services but I could make use of lambda for certain tasks while leveraging the PHP code we already have. We use SST for for some NodeJS (TypeScript) lambdas that have been very popular but PHP isn't going anywhere in our stack so I'd love to find a way to move the bursty parts of it to lambda.

mnapoli

You can deploy using the CDK for example: https://bref.sh/docs/deploy/aws-cdk

joshstrange

Oh wow, that’s almost exactly what I need. Thank you! I don’t know if this is newer or if I just totally missed it the last time I looked.

solardev

What is "SST" in this context? Is it this thing? https://sst.dev/

I'm having trouble understanding where PHP fits into this scenario. If your cloud backend is in PHP, can't you just host that anywhere, separate from your frontends? Where does the serverless come in? And which did you use? (There are so many out there now, from AWS Lambda to Cloudflare to Fastly, etc.)

If you're not limited to AWS, Google's Cloud Run lets you containerize a PHP app and auto-scale it up and back down to zero in bursts, for example. It's not really serverless, just an auto-scaling VM that goes up and down as needed.

edit: google cloud functions might be even closer: https://cloud.google.com/functions/docs/create-deploy-http-p...

joshstrange

Sorry I wasn’t clear.

Yes, that’s the correct SST. Yes, we could host our PHP anywhere and there are options like Cloud Run. We are on AWS and so I was talking about AWS Lambda but I understand that wasn’t clear at all.

The reason for wanting to use Lambda is for bursty/inconsistent workloads. We have EC2 servers that handle all our traffic right now but some are oversized to handle the peaks. There are parts of our system that we could easily offload to lambda to reduce the load on the main servers if we could easily run PHP in lambdas.

I’m going to take a look at the CDK example OP posted (sibling comment to yours) since SST is just a layer over CDK and you can reach down into CDK easily.

solardev

I see, thanks for explaining!

Have you also looked into Elastic Beanstalk? It's an older AWS service but it's made to help you handle bursts or scheduled peaks.

mikece

I don't know which surprises me more: that they continued to use PHP in their move to serverless/microservices or that nobody else on HN has questioned this point yet. I totally get why they would keep PHP: they have the language/platform experience already and AWS supports it (which is really more than enough to silence the "You should have switched to {other_language}!" partisans). Plus, I imaging non-trivial amounts of copy & paste of proven functions was key to moving from monolith to Lambdas... why change the code if it works?

yaseer

I'm wondering if PHP's reputation has been rehabilitated somewhat in recent years. At least amongst those who understand the significant changes in modern PHP, and the difference a stable framework like Laravel makes.

I've found PHP with Laravel a stable and solid workhorse. Good for getting things done quickly, and then a stable system over time.

In contrast, I've gradually become disillusioned with the node.js and JavaScript/TypeScript ecosystem over the years. You can build quickly, but the systems turns into a pain to maintain and update.

kypro

It genuinely amazes me that Node is as popular as it is, especially within large mission critical businesses. If this bank was using TypeScript no one would have questioned it, but you're right, TypeScript is a nightmare to maintain. I probably only use about half of packages I used 5 years ago because either those packages are no longer maintained or the community has switched to some other package that basically does the same thing just in a slightly different way. There's also no real industry standard ways to do anything in Node. You find 10 different Node CRUD projects and they'll all do things completely differently.

The PHP ecosystem on the other hand tends to be less fragmented and these days with frameworks like Laravel the code is generally also pretty good. I think it gets a bad reputation because in the 00s there were some truly horrific PHP projects out there and the language itself was quite immature and poorly designed. That's not the case anymore though. These days I struggle to understand the hate it gets. It's certainly no worse than than Node.

stronglikedan

Perhaps we're finally at a point on HN where people realize there's no need to question the use of PHP. it's a robust, capable language that's just as, or more, suitable for the majority of use cases as any other language.

zelon88

I think most of that was coming from the (then) next generation JS crowd who was trying to fit everything into one neat little box. They've since burnt themselves out and found the limitations in their approach during the process.

Muromec

I’m the usual suspect for shi^W questioning php and I think you are wrong about demographics.

gumballindie

[flagged]

solardev

Just a perspective:

PHP 7+ (the language) was wonderful, especially compared to Javascript's woefully inadequate standard library. It had so many helper functions that made even working with JSON and big data objects much easier.

But having to manage its buildchain wasn't fun (meaning needing to containerize a web server, PHP-FPM, etc. for every trivial deployment). Then needing to support an OS behind it with updates and such, even Dockerized.

For serverless in particular, the availability of V8 isolates (like in CF Workers) or other "just run this snippet of code and don't bother me about the infra" services (like Lambda) or "I can host my serverless in a file alongside my other frontend stuff" (like on Vercel/Netlify) means that JS functions are pretty much zero-config 1-click deploys.

Is there anything like that in the PHP world? For Bref, for example, you have to set up a lot of stuff before the serverless will run: https://bref.sh/docs/setup

For Google Cloud Run (which supports auto-scaling containerized PHP, not true serverless but closer to it than a full VM), you have to manage docker: https://cloud.google.com/run/docs/quickstarts/build-and-depl...

Maybe the closest one I know of is a Google Cloud Function (https://cloud.google.com/functions/docs/create-deploy-http-p...) which comes close to the "function as a service" of JS serverless, but you still at a minimum have to deal with a tiny folder structure (index.php + composer.json).

Is there anything similar on AWS or elsewhere?

distantsounds

your container running the web server and php-fpm should only need to be deployed once. the point of PHP is that to update your code you just... replace the file. this sounds like a poorly designed CI pipeline that is of no fault of PHP.

justinsaccount

It also makes sense if you look at things in the context of Choose Boring Technology [1]. If you have a working PHP app and want to scale into the cloud, you can use a single innovation token to move the app into lambda. This is the key sentence:

> To do a controlled migration, the team deployed the application both to the servers and to AWS Lambda. Only 10 lines of code needed to be changed to run the monolith on AWS Lambda.

[1] https://mcfunley.com/choose-boring-technology

mikece

Interesting to re-read that article again and see that technologies he cites as so cutting edge you're spending innovation tokens on them are now mainstream and very well understood. What would the new "you can use those but you're spending innovation tokens!" technologies would be. Rust? AI? CGP?

djbusby

AI for sure. Rust maybe less. The big thing about these tokens is, folk spend them too early and try to use them for everything.

Part of choose boring is more about choose the right tool.

Would you build a PoC webapp by having AI generate Rust? Or, just bang out a few lines of PHP or JS? If the objective is to build a working business tool it's choice B; if the objective is to test AI making Rust then A

mikece

Did I get voted down because I actually agreed with keeping PHP rather than changing languages? I don't care about the karma points, just curious if someone thought I was attacking PHP because they didn't read the whole comment.

mjburgess

it would be nice if HN had a random "explain your vote" mode where voters had to choose from, eg., agree, helpful, insightful, etc. vs. disagree, unhelpful, provocative

mikece

I will admit that I've made trolling comments from time to time which get well-deserved vote-downs, but there are certainly times where I would like to know what the point of disagreement is because if I'm missing a point of view from which I could learn I would like to know!

solardev

If only there was some other famous tech forum with a descriptive voting system that we could learn from...

(https://slashdot.org/faq/mod-metamod.shtml)

bogota

hur dur php bad because they told me

romanhn

I mean, it's not like that sentiment is totally baseless. I've used PHP years ago and both language and core libraries were not well-designed and came with many footguns. I've heard that modern PHP with frameworks like Laravel fixed a bunch of this, so presumably it's quite capable these days. But PHP certainly wouldn't be anywhere near the top of my go-to list at this point.

munk-a

Eh, at this point can we just stop with the echoing of old memes? I used PHP4 and have used it continuously up to the modern day. If it's not your choice of language that's fine - language choice is pretty unimportant in the grant scheme of things... that said, it can do everything you need it to do (outside of low level memory control). If you need bit-efficient data structures it isn't going to be a good fit... but compared with most other system programming languages it's fine. I'd even go so far as to say it's one of the leading language in terms of meta-programming at this point with an excellent Reflection suite and great built-in magic methods.

greatgib

Treezor is not really directly a bank but more a "bank as a service" company.

Lots of companies or "neobank" that want to offer a kind of bank account, for personal or corporate use, but that don't have an official banking agreement, and not really a banking infrastructure, can use them as "white label" solutions.

All the bank accounts and banking operations will be done by treezor, but from the user point of view, he will only interact with the company and company frontend, and almost never see that it is Treezor that is operating in the background.

That being said, I don't know if their "serverless" move is a good one, because their solution is commonly known to be unreliable, and I think a lot of customers would be happy to go to another provider if it was possible.

mannyv

As a customer of US Bank in the US, I can attest to the fact that they aren’t as reliable as I’d want. Their website and app tend to be “under maintenance” quite often. I think you overestimate the reliability of many bank operations.

syndicatedjelly

App reliability is different from payment service reliability.

Implicated

I've been elbow deep in PHP for well over a decade, and I was genuinely surprised when I first saw this on Twitter. (Insert swaggy p meme here)

I have immense respect for the author, but I'm perplexed about the decision to build a bank on this stack.

Especially considering that the person who created Laravel Vapor (a serverless Laravel service) has since discussed the advantages of moving a large project from Lambda to EC2 (https://twitter.com/themsaid/status/1716844479817154589).

I really do wonder what the bullet points of pros/cons in choosing to go serverless for something like this were.

ceejayoz

That's for a large, fairly consistently loaded project.

For a smaller site with bursty traffic, Lambda may be very relevant still.

padjo

> The migration to microservices is still an ongoing work.

Ain’t that always the way

Muromec

On schedule to be complyted in year, as of three years ago and still 80% in progress

idlewords

A more accurate title here is "bank moves PHP app to Amazon servers"

AndrewDucker

I'd love to know how much the cost changed.

jackconsidine

Love a good lift-and-shift. I wish bref was this well-supported about 3-5 years ago. At that point I was trying to move some PHP services over to serverless. I think I remember seeing bref but it didn't appear to have the clout then. I even think Laravel Vapor didn't use bref when they were setting up PHP runtime configurations etc

ThinkBeat

"" Treezor is an independent provider of outsourcing and white label solutions for electronic payments. "" https://www.crunchbase.com/organization/treezor

So, is this a payment processor much like Stripe?

Fischgericht

Wow, that is just amazing.

So it means that if I connect to treezor.com, I am not talking to a server, but it's direct communication with god in heaven?

And it's not a badly configured server, but the Content "Security" Policy allowing FOURTY different sites, including unsafe inlines (!) is beamed into my brain from a different universe?

And the PHP "software" also clearly is running on a server, because PHP isn't a server-side scripting language, it's all happening in your mind!

/s

Hint: The whole point of a bank is BEING a server, be a central trusted authority accepting and executing transactions from and between clients. A serverless bank is a bank that no longer exists, but got replaced by peer-to-peer transactions.

andrewxdiamond

I don’t understand why people nit-pick the wording “serverless” when the benefits of not having to manage servers is very real.

Yes, there is a computer. Good job, you pointed it out. No one is paying AWS money because they think amazon is somehow running code without computers being involved. They’re paying to run lambdas to avoid dealing with the computers that run the code.

Banks specifically have much higher operational costs due to regulatory requirements. Banks like to focus on their financial strategy and outsource the rest.

Fischgericht

Of course us Nerds know that "serverless" is just a BS marketing term.

I am nitpicking because there are technically uneducated people (managers) who actually believe in these BS marketing terms. People who already thought that such a thing as a "cloud" exists, resulting in us now having to look at our personal data getting stolen once per week because some manager thought you no longer need competent system administrators, because you are just pushing that personal data "to the cloud", so no risks involved.

And in this regard, the term "serverless" is even worse. It's basically the flat earthers of technology.

These BS marketing terms like "cloud" and "serverless" are an excuse for managers to act in an irresponsible fashion, thinking competence is no longer needed in-house. But competence IS needed.

And that's why every single person of "us" in each and every conversation should point out "you are putting the data of your customers and your businesses existence into the hands of someone you don't know at all" and avoid the BS marketing terms. If we go along with them, we are just hurting us, our employers, customers and/or clients, and humanity.

So, in this case the article should be translated into:

"Our intern wrote some crappy PHP shit because he is not really a programmer but a baseball player, and we have decided to just upload and expose all our stuff to some random organization at an unknown location under unknown control so we don't have to deal with this stuff anymore once the intern has left."

:)

allan_s

at Rosaly.com we've been using bref since 2021 and we're extremly happy with it, even if we've stopped to the php-fpm integration. We haven't seen a reason yet to move out of the monolith and bref.sh allow us to have the best of both world (php + lambda )

1. we're a small team and we want to manage as less infra as possible 2. with their "dev mode" docker images, we can a local version which replicate 99% of the production environment (same runtime, same readonly filesystems etc.) 3. deploying is as simple as doing a zip , uploading to s3, and calling lambda update. 4. we have cronjobs with cloudwatch , Symfony's Command.

Daily Digest email

Get the top HN stories in your inbox every day.