Amazon Prime Video’s Microservices Move Doesn’t Lead to a Monolith After All
thenewstack.io
thenewstack.io
This is what I commonly see Lambda turn into and why I think it's real messy. People think that adding another Lambda is as cheap as adding a function in regular code and put them everywhere. I haven't seen it as much with microservices, might just be where I work though.
Cloudflare workers had a interesting solve for this where they don't let you make a http request to another worker, they mount the code for that worker in the same process. Kind of wish AWS could find a way to do that, although since they support multiple runtimes I don't know if it is possible.
Does anyone even consider the monster layers of abstraction that these services require? It’s crazy to me to think someone actually thought using step functions and lambdas in this way was a good idea.
Maybe Amazon used this to test step functions and lambdas.
I've done some AWS training, especially the introductory ones are intended to get you to use as many different services as possible. I'm sure Amazon's internal training is just that.
That sounds like an obvious good thing right? The training isn't supposed to teach you how to solve problems, its supposed to teach you how to use a particular set of tools.
But all too often, the training picks something like "build a clubhouse." And in that, I would expect legit solutions based on specifications of a clubhouse that you are wanting to build.
Language advocates fall hard on this. They will "build a TODO application" to show off part of the language. But end up with an application that can't do what folks would want a TODO application to actually do. It is very frustrating.
The geniuses who led the project before me decided that the first step was to split the file into single payment chunks, then put each one into RabbitMQ, from where a different service would pick them up and parse them - then encode the parsed payments in JSON, and put them back in RabbitMQ, for a third process to pick up and handle. This was all for performance, of course.
I tried to explain that just parsing the whole file in one go would be much faster than splitting it up, writing it to a queue, and reading it back in. That it probably wouldn't be much slower than the splitting. But nobody was interested. Obviously distributing the work would be much faster.
It was a weird experience. My colleagues just had no ability to reason about the "physics" of what computers did. I think they mostly had Rails backgrounds, and I wonder if you just don't exercise that muscle much doing Rails.
It still holds true today, and software has become bloated and slower because these simple rules are being ignored. It's all in the cloud, it's all distributed, it's all "free".
As for Rails - it's the same problem but it's different. If you stay too high up in the abstraction orbit, it's hard to think of the nitty gritty of performance.
What is the cloud doing? What is the ORM doing? Once it's all "magic", you just keep piling on non-performant crap until it becomes an emergency. Then you just add more cache :)
At many jobs I had to deal with the all-hands-on-deck, code red emergency "our AWS bill got too damn high, what can we cut" situation. I can guarantee you a ton of companies are going through this exercise right now.
Some software engineers purposefully develop using fewer resources to force themselves to reason about efficiency.
Abundance leads to complacency and laziness, and those resources are no longer cheap if you are abusing them.
One reason always given is the ability to replay chunks if the system goes down, at least for Kafka.
Same experience here. I feel like I'm always repeating myself when explaining to other developers why we should avoid moving data around unnecessary and prefer to operate directly in the database when necessary, specially when it comes to large data migrations. Also important is why it is bad to do a bunch of small operations instead of batching them in chunks closer to the page size (8 kB).
Not surprised. Rails seems to encourage the worst behavior in developers.
- Step one: put file in queue
- Step two: break down file and insert rows
- Step three: convert to json
- Step four: compute results
- etc...
Once your experience improves you start to understand the cost of such indirection and realise that the problem could have been solved in a much more straightforward manner.
Eh, that's a separate thing - that's how modern streaming works, i.e. it's what allowed streaming to become really, really good, and it's how pretty much every major streaming platform works today.
It’s only crazy to you because you don’t know what you’re doing. But it seems the average HNer isn’t smart enough to digest anything beyond “AWS” and “Cost” before raging about stuff they know nothing about.
Now that you place it like that, it does sound very dubious. The overhead required by uploading MBs go S3 go afterwards have to download it back to the lamdda's execution context should have the same order of magnitude as processing the payload. I'm sure they were aware of this but we're hoping that things would scale well due to the embarrassingly parallel nature of the problem.
I bet this particular story would be fascinating if we had more details, but mostly it's funny (and annoying) that so many people are invested in the idea that there is a "monolith/microservices" debate that makes sense outside of a particular engineering problem and context.
It's funny how in engineering religions arise from anti-religiosity. We have a religion of people yelling "monoliths!" thinking they are not religious but are only fighting against the microservices religion, and vice-versa, a religion of people yelling "microservices!" that think they are not religious but are only fighting against the monolith religion.
The original article[2] about moving to a monolith didn't say much about how those 4 things were built..one binary/script, more?
So I think just a bunch of confusion on what was meant by "monolith".
[1] https://imgur.com/a/6nUFga0
[2] https://www.primevideotech.com/video-streaming/scaling-up-th...
The sweet spot is IMO: Monolith until the monolith becomes truly unwieldy, then break off core pieces of functionality into other services. So 1 monolith -> 4 "microservices". The 100s of microservices is a mistake.
Huh?
Shocking.