Building Microservices: Designing Fine-Grained Systems
Rate it:
Kindle Notes & Highlights
Read between November 1 - December 24, 2017
12%
Flag icon
different types of calls from one service to another,
12%
Flag icon
We want related behavior to sit together, and unrelated behavior to sit elsewhere.
12%
Flag icon
Each bounded context has an explicit interface, where it decides what models to share with other contexts.
12%
Flag icon
If you want information from a bounded context, or want to make requests of functionality within a bounded context, you communicate with its explicit boundary using models.
13%
Flag icon
The stock item then becomes a shared model between the two contexts.
13%
Flag icon
By thinking clearly about what models should be shared, and not sharing our internal representations, we avoid one of the potential pitfalls that can result in tight coupling
13%
Flag icon
In general, microservices should cleanly align to bounded contexts.
13%
Flag icon
if our service boundaries align to the bounded contexts in our domain, and our microservices represent those bounded contexts, we are off to an excellent start in ensuring that our microservices are loosely coupled and strongly cohesive.
13%
Flag icon
Prematurely decomposing a system into microservices can be costly, especially if you are new to the domain. In many ways, having an existing codebase you want to decompose into microservices is much easier than trying to go to microservices from
13%
Flag icon
When you start to think about the bounded contexts that exist in your organization, you should be thinking not in terms of data that is shared, but about the capabilities those contexts provide the rest of the domain.
14%
Flag icon
If our systems are decomposed along the bounded contexts that represent our domain, the changes we
14%
Flag icon
want to make are more likely to be isolated to one, single microservice boundary. This reduces the number of places we need to make a change, and allows us to deploy that change quickly.
14%
Flag icon
The service interface was also very chatty too, resulting in performance issues.
14%
Flag icon
I called this onion architecture, as it had lots of layers and made me cry when we had to cut through it.
15%
Flag icon
Getting integration right is the single most important aspect of the technology associated with microservices in my opinion.
15%
Flag icon
keep the APIs used for communication between microservices technology-agnostic.
15%
Flag icon
Ideally, we’d like to allow our clients full freedom in their technology choice, but on the other hand, providing a client library can ease adoption.
15%
Flag icon
We don’t want our consumers to be bound to our internal implementation.
15%
Flag icon
By far the most common form of integration that I or any of my colleagues see in the industry is database (DB) integration.
16%
Flag icon
First, we are allowing external parties to view and bind to internal implementation details.
16%
Flag icon
Second, my consumers are tied to a specific technology choice.
16%
Flag icon
Strong cohesion and loose coupling — with database integration, we lose both things. Database integration makes it easy for services to share data, but does nothing about sharing behavior.
16%
Flag icon
Event-based systems by their nature are asynchronous.
16%
Flag icon
Event-based collaboration is also highly decoupled.
16%
Flag icon
Tommy
Orchestration vs pub-sub
16%
Flag icon
With orchestration, we rely on a central brain to guide and drive the process, much like the conductor in an orchestra. With choreography, we inform each part of the system of its job, and let it work out the details, like dancers all finding their way
17%
Flag icon
The downside to this orchestration approach is that the customer service can become too much of a central governing authority.
17%
Flag icon
email service, postal service, and loyalty points bank then just subscribe to these events and react accordingly, as
17%
Flag icon
Synchronous calls are simpler, and we get to know if things worked straightaway.
17%
Flag icon
Remote procedure call refers to the technique of making a local call and having it execute on a remote service somewhere.
17%
Flag icon
This is often one of the main selling points of RPC: its ease of use.
17%
Flag icon
With RPC, though, the cost of marshalling and un-marshalling payloads can be significant, not to mention the time taken to send things over the network.
18%
Flag icon
This brittleness results in the types being exposed over the wire and becoming a mass of fields, some of which are no longer used but can’t be safely removed.
19%
Flag icon
How a resource is shown externally is completely decoupled from how it is stored internally.
19%
Flag icon
REST architectural style actually tells us that methods should behave the same way on all resources,
19%
Flag icon
and the HTTP specification happens to define a bunch of methods we can use.
19%
Flag icon
The idea behind HATEOAS is that clients should perform interactions (potentially leading to state transitions) with the server via these links to other resources. It doesn’t need to know where exactly customers live on the server by knowing which URI to hit; instead, the client looks for and navigates links to find what it needs.
21%
Flag icon
The overhead of HTTP for each request may also be a concern for low-latency requirements.
21%
Flag icon
But once it does, it can be an incredibly effective way to implement loosely coupled,
21%
Flag icon
However, vendors tend to want to package lots of software with them, which can lead to more and more smarts being pushed into the middleware, as evidenced by things like the Enterprise Service Bus.
21%
Flag icon
keep your middleware dumb, and keep the smarts in the endpoints.
21%
Flag icon
If you already have a good, resilient message broker available to you, consider using it to handle publishing and subscribing to events.
21%
Flag icon
fallacy. If you find yourself wanting more and more of the support that a message broker gives you, at a certain point you might want to change your approach.
22%
Flag icon
We also created a UI to view those messages and retry them if needed.
Tommy
Create a ui for integration monitoring
22%
Flag icon
Ensure you have good monitoring in place, and strongly consider the use of correlation IDs, which allow you to trace requests across process boundaries, as we’ll cover in depth in Chapter 8
22%
Flag icon
We want to avoid dumb, anemic services that are little more than CRUD wrappers.
22%
Flag icon
Reactive Extensions Reactive extensions, often shortened to Rx, are a mechanism to compose the results of multiple calls together and run operations on them.
Tommy
RX.net, observable stream
22%
Flag icon
As you find yourself making more service calls, especially when making multiple calls to perform a single operation,
22%
Flag icon
One of the things we want to avoid at all costs is overly coupling a microservice and consumers such that any small change to the microservice itself can cause unnecessary changes to the consumer.
22%
Flag icon
Sometimes, however, the use of shared code can create this very coupling.