News for hackers. Stuff that matters.
Re:So many bad takes. Learn from the Prime Video microservic... by babyshake on Sunday May 07, 2023 @02:43PM (#35854312)
One potential reason to advocate for serverless architecture is it is relatively stateless and event-driven and therefore modular and easy to reason about.

Can you be more specific about how serverless tends to turn into a ball of spaghetti? It is simply because the lack of state becomes more of a bug than a feature?

Re:So many bad takes. Learn from the Prime Video microservic... by jpgvm on Sunday May 07, 2023 @02:57PM (#35854447)
State can be part of it. For example it can be way simpler to use a in-memory cache than a network attached cache and by doing so you save yourself a dependency, a potential network request that can fail, etc.

Also for event processing consider the case you need to process events in order for instance. That is a ton easier with stateful consumers, batching etc which while possible in serverless is usually more difficult/off the beaten path.

However by spaghetti I'm more referring to the architecture of your application being turned into networked components, i.e a distributed system.

It's pretty much accepted fact now that distributed systems are by far the most challenging area of both computer science and software engineering.

Serverless doesn't technically -mandate- this, you could put all your code in a giant function. However it strongly incentivises you not to. a) generally it's deployment times and cold start issues get worse with function size and b) it pushes you to adopt other "building blocks" which are themselves network attached.

Essentially it leads people into a massively distributed micro-service architecture right out of the gate. For most applications this is definitely the wrong choice even if you have the folks on staff that specialise in distributed systems, usually those folk are the last to advocate for anything distributed ironically.

Getting into the weeds as for why this is hard and all the problems you can run into is probably a bit much for a single HN comment but if you really are curious I suggest reading Leslie Lamport and John Ousterhout. Both have covered the problem space in depth with foundational papers, Leslies "Time, Clocks, and the Ordering of Events in a Distributed System" in particular is foundational.

Re:So many bad takes. Learn from the Prime Video microservic... by eternalban on Sunday May 07, 2023 @05:03PM (#35855569)
(quite impressed by the sheer number of comments you have made in this thread, btw)

> For example it can be way simpler to use a in-memory cache than a network attached cache and by doing so you save yourself a dependency, a potential network request that can fail, etc.

Elsewhere you decided against using cloudflare's kv because it was a poor fit for "cache invalidation" -- "way simpler"? -- and then of course turns out you really don't know if it's a bad fit.

> by spaghetti I'm more referring to the architecture of your application being turned into networked components, i.e a distributed system.

That is a novel definition of "spagetti". It's a pejorative term in software sense. Why?

> It's pretty much accepted fact now that distributed systems are by far the most challenging area of both computer science and software engineering.

Ahem. So it caching and cache invalidation. But that didn't stop you, so exactly how is this line you seem to draw with such vocal authority regarding "bad hard", "good hard" informed technically?

Re:So many bad takes. Learn from the Prime Video microservic... by _gabe_ on Sunday May 07, 2023 @05:26PM (#35855769)
> That is a novel definition of "spagetti". It's a pejorative term in software sense. Why?

I don't necessarily agree with everything OP is saying, and I certainly don't speak for them, but I completely understand what they mean by a big ball of microservice spaghetti. The spaghetti is distributed across a massive literal network of dependencies instead of being distributed off a giant graph of object dependencies, or goto statements or something. The spaghetti is real and just as messy in the microservice world as the monolith world. I should know, we inherited a massive one.

But this shouldn't be too much of a revelation since there is no silver bullet in taming software architecture. Architecting software is very subjective, and more often than not we make the wrong decisions and have to untangle the mistakes further down the road.

Re:So many bad takes. Learn from the Prime Video microservic... by eternalban on Sunday May 07, 2023 @05:59PM (#35856023)
> I completely understand what they mean by a big ball of microservice spaghetti

Sure, I understand that too, but that's not what was said. Here it is again:

> by spaghetti I'm more referring to the architecture of your application being turned into networked components, i.e a distributed system.

Re:So many bad takes. Learn from the Prime Video microservic... by Aeolun on Sunday May 07, 2023 @10:46PM (#35857558)
How is that not what was said. Your application is going to be spaghetti anyway, networked spaghetti is orders of magnitude worse.

I should know, I have a ball of networked spaghetti.

Re:So many bad takes. Learn from the Prime Video microservic... by intelVISA on Monday May 08, 2023 @05:35AM (#35859735)
Chef's law: spaghetti cannot be removed or added, only distributed.
Re:So many bad takes. Learn from the Prime Video microservic... by jpgvm on Sunday May 07, 2023 @06:24PM (#35856189)
> Elsewhere you decided against using cloudflare's kv because it was a poor fit for "cache invalidation" -- "way simpler"? -- and then of course turns out you really don't know if it's a bad fit.

I evaluated it at the time. I don't have the context loaded to remember exactly why it didn't work for my use-case but I'm going to look again because CFs platform moves pretty fast and perhaps it could be simpler than what we are currently doing.

> That is a novel definition of "spagetti". It's a pejorative term in software sense. Why?

Elsewhere it's been coined Lambda Pinball, perhaps you find that a more pleasing description?

> Ahem. So it caching and cache invalidation. But that didn't stop you, so exactly how is this line you seem to draw with such vocal authority regarding "bad hard", "good hard" informed technically?

Yes, both of which are generally necessary in distributed systems. i.e not only is it a hard problem in and of itself it requires solving sub-problems which are also some of the hardest problems.

I think you may have made my points for me.

Re:So many bad takes. Learn from the Prime Video microservic... by zerbinxx on Monday May 08, 2023 @12:17AM (#35858036)
I think in general you’re right on the money and have been throughout your comments here. Lambda pinball is a great term as well. I agree that serverless incentivizes a “nanoservice” approach that flies in the face of patterns like classes/factories or DDD, since everything is atomic you lose the concept of a service or domain boundary and everything can get muddled as hell.
Re:So many bad takes. Learn from the Prime Video microservic... by scarface74 on Sunday May 07, 2023 @05:59PM (#35856020)
> Also for event processing consider the case you need to process events in order for instance. That is a ton easier with stateful consumers, batching etc which while possible in serverless is usually more difficult/off the beaten path

By off the beaten path you mean a few lines of yaml to configure a FIFO SQS queue and have it trigger a Lambda?

Re:So many bad takes. Learn from the Prime Video microservic... by empthought on Sunday May 07, 2023 @09:25PM (#35857151)
I notice the GP hasn't responded to this. If Lambdas couldn't be a target for SNS or SQS, I wouldn't bother with them either. But that has been a core architectural pattern since 2018.

https://aws.amazon.com/blogs/aws/aws-lambda-adds-amazon-simp...

Re:So many bad takes. Learn from the Prime Video microservic... by ricardobeat on Sunday May 07, 2023 @03:37PM (#35854841)
Modular, maybe (though sometimes it's just introducing a network hop in between dependencies). Event-driven being easy to reason about? No way, never.
Re:So many bad takes. Learn from the Prime Video microservic... by erikpukinskis on Sunday May 07, 2023 @04:35PM (#35855389)
Yah, I was confused by that too. Out of:

1) event-driven

2) procedural

3) functional

4) inheritance

I would say event-driven is tied for last as the hardest to reason about.

Re:So many bad takes. Learn from the Prime Video microservic... by emodendroket on Sunday May 07, 2023 @04:39PM (#35855425)
I'd say it comes down to your choice of events. I also find these systems very easy to reason about.
Re:So many bad takes. Learn from the Prime Video microservic... by tharkun__ on Sunday May 07, 2023 @05:26PM (#35855767)
Instead of your IDE very easily telling you on click the callers or callees of things you'd rather have events where you have no idea who might be processing or sending a particular event in your system of hundreds of microservices?

Yeah, totally easy!

Re:So many bad takes. Learn from the Prime Video microservic... by ShroudedNight on Sunday May 07, 2023 @05:55PM (#35855995)
I think you're conflating problems here. IDLs allow interface definitions for interactions that cross compute and administrative boundaries, and event-driven architectures do not require compute distribution (Erlang/beam).

Different people have different strengths and anxieties. The suggestion that, with some regularity, the lack of (local) ambiguity of event message arrival may be of higher leverage relative to complexity than increasing the surface of an invokable interface does not seem beyond the pale.

Ultimately relinquishing a total temporal ordering is going to be painful regardless of whether it's local or distributed.

Re:So many bad takes. Learn from the Prime Video microservic... by tharkun__ on Sunday May 07, 2023 @08:02PM (#35856768)
That's fair enough if you use something that actually does this and also keeps track of users of your event. Not saying it is unsolvable.

What I've seen though is that in many cases it is unsolved for and it's very hard to reason about "if I remove this event because it's 5 versions too old already and I don't want to keep this backwards compatibility layer, will something "at the other end of our system I never even interact with" puke?

Granted some orgs are so big that it makes sense to solve for these large landscapes of services with backwards compatibility ad absurdum in order to allow anything to get done (been at that bank, done that). But reason about the entire system it does not make easier.

At many smaller orgs these services were also not built because of organizational issues that needed to be solved but because "everyone does this now" and there's no proper registry of properly defined interfaces and trying to find out if a change you were going to make is going to take you forever because you do need to version something or if you can just change things as needed is way harder than it's supposed to be at that size org.

Re:So many bad takes. Learn from the Prime Video microservic... by emodendroket on Monday May 08, 2023 @12:25AM (#35858074)
It's freeing you to reason about only one step rather than the entire system at all times.
Re:So many bad takes. Learn from the Prime Video microservic... by tharkun__ on Monday May 08, 2023 @08:24PM (#35868750)
Fair enough that it's freeing overall if your org is so large that it is faster to always be 100% backwards compatible for aeons.

I repeat: most orgs that go all in on this are actually so small that being so compatible is more of a drag than understanding the part of the system that is attached to the interface you are trying to change ;)

Re:So many bad takes. Learn from the Prime Video microservic... by emodendroket on Monday May 08, 2023 @10:03PM (#35869399)
Well that's what I mean about choosing the right events. If you are needing to keep multiple systems in your head all the time the boundaries are wrong. But it's true that evolving the interface of services is hard.
Re:So many bad takes. Learn from the Prime Video microservic... by xvinci on Sunday May 07, 2023 @04:04PM (#35855106)
Statelessnes is really a prerequisite for proper horizontal scaling (with small exceptions), so best practices for e.g. spring boot web applications will lead to a stateless architecture as well. Same goes for event-driven -> amqp, mqtt (and jms for java) plug easily into most modern web-frameworks, you can be as event-driven as you want to (which in my experience is an overhead to plain http / rest which needs to be justified)
Re:So many bad takes. Learn from the Prime Video microservic... by ShroudedNight on Sunday May 07, 2023 @05:37PM (#35855855)
> Statelessnes is really a prerequisite for proper horizontal scaling

I could understand making this claim w.r.t. Idempotence. Claiming statelessnes as a requirement strikes me as non-trivial enough to require some evidence or a citation thereto.

Re:So many bad takes. Learn from the Prime Video microservic... by namaria on Sunday May 07, 2023 @05:19PM (#35855705)
>stateless and event-driven and therefore modular

Non-sequitur