Building Microservices: Designing Fine-Grained Systems
Rate it:
Kindle Notes & Highlights
Read between November 1 - December 24, 2017
22%
Flag icon
forgot. If your use of shared code ever leaks outside your service boundary, you have introduced a potential form of coupling.
22%
Flag icon
My general rule of thumb: don’t violate DRY within a microservice, but be relaxed about violating DRY across all services.
23%
Flag icon
The more logic that creeps into the client library, the more cohesion starts to break down, and you find yourself having to change multiple clients to roll out fixes to your server.
23%
Flag icon
We need to embrace the idea that a microservice will encompass the lifecycle of our core domain entities,
23%
Flag icon
The best way to reduce the impact of making breaking changes is to avoid making them in the first place.
23%
Flag icon
REST, on the other hand, helps because changes to internal implementation detail are less likely to result in a change to the service interface.
24%
Flag icon
This pattern — of implementing a reader able to ignore changes we don’t care
24%
Flag icon
about — is what Martin Fowler calls a Tolerant Reader.
24%
Flag icon
“Be conservative in what you do, be liberal in what you accept from others.”
24%
Flag icon
Semantic versioning is a specification that allows just that.
24%
Flag icon
When MINOR increments, new functionality has been added that should be backward compatible.
24%
Flag icon
This versioning scheme allows us to pack a lot of information and expectations into just three fields.
24%
Flag icon
if we want to release a breaking change, we deploy a new version of the service that exposes both the old and new versions of the endpoint.
25%
Flag icon
blue/green deployments
25%
Flag icon
The longer it takes for you to get consumers upgraded to the newer version and released, the more you should look to coexist different endpoints in the same microservice rather than coexist entirely different versions.
26%
Flag icon
This pattern is sometimes referred to as backends for frontends (BFFs)
26%
Flag icon
The business logic for the various capabilities these backends use should stay in the services themselves. These BFFs should only contain behavior specific to delivering a particular user experience.
27%
Flag icon
“Build if it is unique to what you do, and can be considered a strategic asset; buy if your use of the tool isn’t that special.”
27%
Flag icon
it might make more sense to change how your organization works rather than embark on complex customization.
27%
Flag icon
even a minor-point upgrade in the underlying tool can break any customizations you have made.
27%
Flag icon
Salesforce is especially troublesome in this regard.
28%
Flag icon
Treat the CMS as a service whose role is to allow for the creation and retrieval of content.
28%
Flag icon
The scope of such a tool typically starts small, but over time it becomes an increasingly important part of how your organization works. The problem is that the direction and choices made around this now-vital system are often made by the tool vendor itself, not by you.
28%
Flag icon
identify the core concepts to our domain that the CRM system currently owned.
28%
Flag icon
A useful pattern here is the Strangler Application Pattern
28%
Flag icon
Avoid database integration at all costs. Understand the trade-offs between REST and RPC, but strongly consider REST as a good starting point for request/response integration. Prefer choreography over orchestration.
28%
Flag icon
Avoid breaking changes and the need to version by understanding Postel’s Law and using tolerant readers. Think of user interfaces as compositional layers.
29%
Flag icon
seam — that is, a portion of the code that can be treated in isolation and worked on without impacting the rest of the codebase.
29%
Flag icon
we discussed previously, bounded contexts make excellent seams,
30%
Flag icon
A great place to start is to use a tool like the freely available SchemaSpy, which can generate graphical representations of the relationships between tables.
30%
Flag icon
The quickest way to address this is rather than having the code in finance reach into the line item table, we’ll expose the data via an API call in the catalog package that the finance code can call.
30%
Flag icon
Typically concerns around performance are now raised. I have a fairly easy answer to those: how fast does your system need to
30%
Flag icon
Sometimes making one thing slower in exchange for other things is the right thing to do, especially if slower is still perfectly acceptable.
30%
Flag icon
But what about the foreign key relationship? Well, we lose this altogether. This becomes a constraint we need to now manage in our resulting services rather than in the database level.
31%
Flag icon
What we actually have here is something you’ll see often — a domain concept that isn’t modeled in the code, and is in fact implicitly modeled in the database. Here,
31%
Flag icon
I would actually recommend that you split out the schema but keep the service together before splitting the application code out into separate microservices,
32%
Flag icon
eventual consistency. Rather than using a transactional boundary to ensure that the system is in a consistent state when the transaction completes, instead we accept that the system will get itself into a consistent state at some point in the future.
32%
Flag icon
Another option is to reject the entire operation.
32%
Flag icon
report back via the UI that the operation failed.
32%
Flag icon
what happens if our compensating transaction fails?
32%
Flag icon
allow some backend process to clean up the inconsistency later on.
32%
Flag icon
Handling compensating transactions for each failure mode becomes quite challenging to comprehend, let alone implement.
33%
Flag icon
When you encounter business operations that currently occur within a single transaction, ask yourself if they really need to. Can they happen in different, local transactions, and rely on the concept of eventual consistency?
33%
Flag icon
If you do encounter state that really, really wants to be kept consistent, do everything you can to avoid splitting it up in the first place. Try really hard.
33%
Flag icon
In a standard, monolithic service architecture, all our data is stored in one big database.
33%
Flag icon
So a change in schema has to be carefully managed.
33%
Flag icon
Second, we have limited options as to how the database can be optimized for either use case
33%
Flag icon
Finally, the database options available to us have exploded recently.
33%
Flag icon
To report across data from two or more systems, you need to make multiple calls to assemble this data.
34%
Flag icon
You could resolve this by exposing batch APIs to make reporting easier.