News for hackers. Stuff that matters.
Re:Give me back my monolith (2019) by blowski on Tuesday May 10, 2022 @03:24PM (#31331450)
You drop in “…or a network failure” like it’s a rare occurrence that’s easy to handle.
Re:Give me back my monolith (2019) by staticassertion on Tuesday May 10, 2022 @03:29PM (#31331507)
Frequency is irrelevant to the complexity. As I said, you have to handle the idea of cross-boundary failures, such as with modules that have bugs.

If you aren't taking steps to do so, you're not writing robust code.

Anyway, yes, persistent network failures are rare for many people.

Re:Give me back my monolith (2019) by travisd on Tuesday May 10, 2022 @03:46PM (#31331725)
At some point, you can't gracefully handle bugs in other peoples code. If a function you call causes a SEGFAULT, in the vast majority of software, you're not expected to handle that. That's an invariant error, and you probably want some way to detect that it happened so you can fix it, but it's not reasonable to ask every caller of every function to handle that (in the same way we don't consider "the earth blew up" to be a reasonable thing to protect against, even though it its technically possible). There's simply not enough time and money to protect against every possible edge case in most software (NASA projects aside).

The argument here is that network issues are exceedingly common in microservice environments and so aren't actually an edge failure case, so you actually have to worry about them way more than you would worry about a function in a different module causing a SEGFAULT.

Re:Give me back my monolith (2019) by staticassertion on Tuesday May 10, 2022 @03:54PM (#31331838)
The point is not to handle individual bugs, it is to handle all failures. This is the difference between a "defensive programming" approach and the "let it crash"/ "zen of erlang" approach. Actors are designed such that they have failure isolation, which means they can react to errors in other actors without worrying about their own state. They then have two options based on one of two bug classes - transient and persistent.

Persistent errors are propagated to the supervisor. Transient errors are either retried or propagated.

It doesn't matter if it's a network error, a disk error, a timeout, a crash, a cosmic radiation bit flip - your approach is always one of those two. So adding more failure cases doesn't "matter" in terms of your error handling, although you may want to adopt helpful patterns in the nuances of "retry".

The frequency of errors will obviously increase with a network error (arguably very very little), but the pattern is fundamental to resiliency.

If your network is truly so unreliable that you can not pay that cost, don't do it. I don't think most people are developing on networks that fail for long periods of time frequently.

Re:Give me back my monolith (2019) by kaba0 on Tuesday May 10, 2022 @07:35PM (#31334016)
But now you are talking squarely about Erlang actors, not microservices in general. The runtime gives you all the needed guarantees here.
Re:Give me back my monolith (2019) by staticassertion on Wednesday May 11, 2022 @07:59AM (#31338616)
I talk about services and actors interchangeably because there's no interesting differences between them.
Re:Give me back my monolith (2019) by kaba0 on Wednesday May 11, 2022 @05:02PM (#31345717)
Other than automatic handling of network exceptions, safe failiures and the shitton of other features Erlang runtimes have?
Re:Give me back my monolith (2019) by staticassertion on Thursday May 12, 2022 @04:12PM (#31359619)
I'm not sure what you're talking about. What automatic handling of network exceptions? What safe failures? BEAM has lots of great features, no question, but they have very little to do with the implementation of actors - BEAM primarily provides names and linking as useful primitives.
Re:Give me back my monolith (2019) by ori_b on Tuesday May 10, 2022 @04:19PM (#31332139)
Network calls can appear to fail, but actually succeed.

Local function calls don't have to deal with byzantine failures[1].

[1] https://en.wikipedia.org/wiki/Byzantine_fault

Re:Give me back my monolith (2019) by staticassertion on Tuesday May 10, 2022 @04:31PM (#31332280)
Function calls can, of course, fail with side effects. Idempotency is always a desirable property.
Re:Give me back my monolith (2019) by blowski on Tuesday May 10, 2022 @03:30PM (#31331523)
> Frequency is irrelevant to the complexity

So if something happens 50% of the time you should treat it in the same as if it happens one in 100 billion?

Re:Give me back my monolith (2019) by staticassertion on Tuesday May 10, 2022 @03:34PM (#31331556)
Maybe? I can't compare 50% to 100 billion. If your computer crashed every 100 billion instructions that would be a problem. If it crashed every other instruction, that would be very slightly more (or the same amount) of a problem.

The point is that if you have a function call, you have the opportunity for a bug/ failure. Networks don't change that - you have the opportunity for a bug/ failure. The major difference is that services have stronger failure isolation.

Re:Give me back my monolith (2019) by blowski on Tuesday May 10, 2022 @03:42PM (#31331668)
It sounds like you’re designing a very hypothetical bit of software.
Re:Give me back my monolith (2019) by staticassertion on Tuesday May 10, 2022 @04:03PM (#31331951)
As opposed to designing software that is already implemented?