Better HN
topnewbestaskshowjobs
Log inSign up

staticassertion

13,486 karma · joined Jun 1, 2016 (10y ago) · 4,896 submissions

@insanitybit
Submissions

comment 4y ago · link · parent

I'm not sure it's one-click. Visiting a page isn't exactly "clicking" - I'd expect a "click" in this sense to be like a browser asking "are you sure?" and you clicking through, or "play video".

But it's not super clear cut. Like, let's say you had to open up a message on your phone for the exploit to work - you clicked the message, right? idk

comment 4y ago · link · parent

I talk about services and actors interchangeably because there's no interesting differences between them.

comment 4y ago · link · parent

Well... don't do that? This is where microservices comes in. In a SOA architecture nothing really tells you when it's a good idea to split things up. Microservices is a methodology to help you avoid this exact situation.

You'd have the same problem in a monolith if you have two different modules working on the same db.

comment 4y ago · link · parent

> Securing the network is more work than just securing the code, because now there's a network in the way.

I very much disagree.

> For all the repetition you have on this thread, can you summarize it with the actual benefit that you have gained in a serious production use?

I already have summarized it. All I've done since is correct people being incorrect with regards to my summary.

If you want a specific example, here's a blog post I wrote a long time ago (the dates are incorrect since we moved websites): https://www.graplsecurity.com/post/architecting-for-performa...

comment 4y ago · link · parent

I'm ignoring the first two points since I'm tired of explaining these things to people - you can read the papers/ watch the talks I've linked.

> How exactly? It's not magic, you still have to apply them, and now it requires more strategies and effort to accomplish.

Yes, we have tons of tooling for process isolation. Splitting a service into two services means you can isolate two processes instead of one, which means you break up the capabilities unique to each.

I used the word "apply" so I don't know why you're saying "you still have to apply them"... it's literally what I just said.

comment 4y ago · link · parent

What you said was that Kay would disagree, and that we must have gotten OO wrong otherwise. Kay wouldn't disagree and Kay would say we got OO wrong.

comment 4y ago · link · parent

We all share state in that we all exist within the same universe. But the universe has laws of causality, and Joe advocated that software should always maintain causal consistency.

A database is not needed for your example. You could replace it with an actor holding onto its own memory. But all mutations to that actor, which the other actors hold references to via their mailbox, are causally consistent and observable.

That is the premise of the talk I linked elsewhere.

comment 4y ago · link · parent

I can agree with all of that, I wasn't trying to imply otherwise, more just explaining that stating that OOP means what Kay wanted it to mean is ignoring history, consensus, and Kay himself.

comment 4y ago · link · parent

Function calls can, of course, fail with side effects. Idempotency is always a desirable property.

comment 4y ago · link · parent

I don't really understand. If I have a database, and a service is talking to it, it can open a transaction. If I then want to talk to other services, and rollback that transaction based on what happens with those, I can do that.

Microservices changes nothing about this. If you want to remove transactions by splitting up your logic such that it operates in terms of sequences or something, you can do that, but that's just a choice like any other.

comment 4y ago · link · parent

There are many solutions, certainly. A network is one option, which I personally prefer, but as I said elsewhere it's a "choose the right tool for the job" kind of situation.

comment 4y ago · link · parent

As opposed to designing software that is already implemented?

comment 4y ago · link · parent

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.

comment 4y ago · link · parent

Then you interpreted it incorrectly. I'm not inclined to teach you via HN about a subject that's well documented by resources I've already linked.

comment 4y ago · link · parent

So use transactions? I don't understand what part of microservices prevents that. In fact, transactions are pretty fundamental to reliable systems.

https://www.hpl.hp.com/techreports/tandem/TR-85.7.pdf

From the abstract:

>It is pointed out that faults in production software are often soft (transient) and that a transaction mechanism combined with persistent process-pairs provides fault-tolerant execution -- the key to software fault-tolerance.

comment 4y ago · link · parent

Function parameters aren't messages. They're shared state. I'd suggest watching the talk and reading about message passing systems in general.

comment 4y ago · link · parent

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.

comment 4y ago · link · parent

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.

comment 4y ago · link · parent

I would hope it's obvious that you haven't mutated A's memory, but I'll just suggest you watch the talk.

comment 4y ago · link · parent

No, it's physically impossible. You have causal consistency across services, not within services.

https://youtu.be/lKXe3HUG2l4?t=1438

comment 4y ago · link · parent

I didn't say it removes state. I said it split the state up and isolated it. That's critically important - you physically can not mutate state across a network, you have to pass messages from one system to the other over a boundary, either via some protocol like TCP or via intermediary systems like message brokers.

Joe Armstrong talks about this better than I'm going to: https://youtu.be/lKXe3HUG2l4?t=1438

That timestamp is rough, I just found a related section of the talk.

> And the network-defined state is a hell of a lot harder to trace and debug.

There's no such thing as network-defined state. I assume you're saying that it's harder to debug bugs that span systems, which is true, but not interesting since that's fundamental to concurrent systems and not to microservices.

comment 4y ago · link · parent

It also makes bin packing services much simpler for that same reason.

comment 4y ago · link · parent

> Network boundaries cause far more problems than they solve,

They cause exactly 0 extra problems. A call from function A to function B can fail due to B having a bug. A call from service A to service B can fail due to B having a bug or a network failure. Either way, failure is possible and has to be handled - the network only makes that more obvious.

Further, a call between functions can cause mutated shared state - not the case across a boundary, they physically do not share mutable state.

> and you've just shifted the complexity to now securing the network

Not really. Fundamentally you have split your service capabilites up - now you can apply least privilege as you desire.

comment 4y ago · link · parent

I'm extremely aware of Alan Kay's statement, as well as the foundations of the actor model. The reality is that today that is not what OOP has become, and Alan Kay would agree.

> that suggests we got OOP wrong, very wrong.

Alan Kay very clearly states that people "got it wrong" and that OOP was supposed to be about messaging. ie: He intended for it to be one thing, but it isn't that thing.

> I'm sorry that I long ago coined the term "objects" for this topic because it gets many people to focus on the lesser idea. The big idea is "messaging"

> The key in making great and growable systems is much more to design how its modules communicate rather than what their internal properties and behaviors should be. [..]

http://wiki.c2.com/?AlanKayOnMessaging

https://computinged.wordpress.com/2010/09/11/moti-asks-objec...

comment 4y ago · link · parent

> There is still coupling in microservices, it has just shifted to messaging, networking, and queuing.

Sure, in the sense that your service is "coupled" to a queue and if you don't abstract that away it's hard to change that queue implementation. But in the sense of two services you wrote being coupled, they aren't, in terms of shared state. That gets pulled out. There is no way for one service to mutate the memory of another - it has to send a message to it.

That can be TCP or it can be over some queue or stream or whatever.

> If you get any of those parts wrong, you have a worse mess to untangle with less mature debugging/logging tooling than a monolith enjoys

This is the case with any concurrent system. The fact that so many languages lack concurrency primitives is probably why people don't run into this more often. If you use concurrency primitives in your language, you already have this.

> all the while likely dealing with eventual consistency (depending on the design)

There's nothing eventually consistent about this system. It fundamentally has causal consistency (since messages from a service must come after messages to that service that triggered them), and it's perfectly capable of leveraging transactions.

> I'm not saying don't start with a microservice, but it likely wouldn't be the very first tool I would reach for when starting out if a monolith would do the job effectively.

To each their own. I much prefer it. It's far simpler to maintain "good" design since the network boundary creates a hard line in the sand that you physically can not violate.

comment 4y ago · link · parent

> Setup went from intro chem to quantum mechanics

Doesn't really seem fair. On the one hand you might need to do a bit of work so that you can say `docker-compose up` or `nomad up` or whatever, but at the same time there are plenty of issues with running binaries/databases directly on a laptop - version skew, for instance.

> So long for understanding our systems

This is fundamental to all asynchronous systems. You don't have backtraces anymore. If your service has concurrency primitives you probably already have to solve this problem with tracing, microservices just give you another asynchronous primitive.

> If we can’t debug them, maybe we can test them

Bringing up your entire application is what you'd have to do in a monolith as well, I don't understand this criticism. Also, "teaching" your CI to do this is 0 additional work - it's gonna be another "docker-compose up" or whatever, generally speaking.

Our microservice codebase runs on laptops just as it runs in the cloud. It's pretty nice.

With regards to "That is probably a bit too much effort so we’re just going to test each piece in isolation" - again, this is the same thing with your monolith. You'll just do this at the module level.

This is really a "right tool for the job" situation. And that's hard for people to understand, since oftentimes you don't know what you're building upfront.

comment 4y ago · link · parent

It's SOA with specific patterns and disciplines, centered primarily around the concept of the 'bounded context'. But if you want to just start with SOA and learn those patterns as you go, or dig into the book/ blog posts on bounded contexts, go for it.

comment 4y ago · link · parent

> Microservices was always a solution to the organisational problem of getting more developers working on a system at once.

I don't really agree. It's probably the most agreed upon benefit, but there are others. Fundamentally, microservices allow you to isolate state. I can take two services and split them up - and now I've split their state spaces. I can put a queue service between them and now I've sliced out the state of their communication.

This slicing up of state has a ton of benefits if done right.

1. Isolation of state is basically the key to having scalable concurrency. Watch the Whatsapp talk on Erlang and they say "Isolation, Isolation, Isolation".

2. Isolation of services is great for security. You can split up permissions across your services, limit their access in a more granular way, etc.

Those are pretty nice wins. They're achievable through discipline in a monolith (heavy use of module boundaries, heavy use of immutability - something most mainstream languages don't encourage) but a network boundary really forces these things and makes unintentional stateful coupling a lot more painful.

> It is easier to start with a monolith, find the right design and then split on the boundaries than it is to make the correct microservices to begin with.

I disagree. Starting with a bad set of microservices can be fixed by merging. Merging two codebases is trivial compared to splitting. Again, if I have isolation between the services, even if the slicing up was done badly, even if they're coupled, I can just remove the layer between them.

Splitting has to start from a place of coupling and then try to decouple - this is especially hard with languages that encourage encapsulated mutable state (most of them).

1
454647
164