Building Microservices: Designing Fine-Grained Systems 1st Edition
Distributed systems have become more fine-grained in the past 10 years, shifting from code-heavy monolithic applications to smaller, self-contained microservices. But developing these systems brings its own set of headaches. With lots of examples and practical advice, this book takes a holistic view of the topics that system architects and administrators must consider when building, managing, and evolving microservice architectures.
Microservice technologies are moving quickly. Author Sam Newman provides you with a firm grounding in the concepts while diving into current solutions for modeling, integrating, testing, deploying, and monitoring your own autonomous services. You’ll follow a fictional company throughout the book to learn how building a microservice architecture affects a single domain.
- Discover how microservices allow you to align your system design with your organization’s goals;
- Learn options for integrating a service with the rest of your system;
- Take an incremental approach when splitting monolithic codebases;
- Deploy individual microservices through continuous integration;
- Examine the complexities of testing and monitoring distributed services;
- Manage security with user-to-service and service-to-service models;
- Understand the challenges of scaling microservice architectures.
What Are Microservices?
Microservices are small, autonomous services that work together. Let’s break that definition down a bit and consider the characteristics that make microservices different.
The benefits of microservices are many & varied. Many of these benefits can be laid at the door of any distributed system. Microservices, however, tend to achieve these benefits to a greater degree primarily due to how far they take the concepts behind distributed systems and service-oriented architecture.
Key benefits include in the ebook Building Microservices
- Technology Heterogeneity;
- Ease of Deployment;
- Organizational Alignment;
- Optimizing for Replaceability.
About the author:
Sam Newman is interested in how different aspects of technology intersect, from development to ops, to security, usability, and organizational structures. After 20 years in the industry, Sam now runs his own consulting and training company, Sam Newman and Associates, focusing on the area of Microservices, Cloud, and CI/CD.
Sam has worked with a variety of companies across multiple industries all over the globe, often with one foot in the developer world, and another in the IT operations space. He has written articles, presented at conferences, and sporadically commits to open source projects. Sam is the author of the bestselling Building Microservices from O’Reilly.
Reviews about the ebook:
You wanted to read a hipster guide on how microservices are a silver bullet and how should you never ever build a monolithic system again? Sorry, this is not the book for ya. This is not another buzzwordy book on microservices, this is actually a very mature book on modern software architecture – building distributed systems using smaller-sized services (microservices if you will) instead of building large monolithic systems.In my opinion, this book should be read by people used to building traditional monolithic applications, using layered architecture and backed by a relational database.
The author (Sam Newman) will talk about distributed systems in general and new challenges introduced by migration towards this style. Microservices aren’t a silver bullet and perhaps you shouldn’t even start with building one, monolithic codebases are fine for short or mid-term runs, you can iterate fast, and refactoring and re-shuffling is easy. Once you have a solid understanding of your business domain then you could start considering the migration to smaller services (the catch here is to identify the time when this is needed, it shouldn’t be either too soon or too late). A facade design pattern is a good friend for building coarse-grained services (within the monolith) and then splitting them into smaller services.
Continuous delivery changes once you own multiple microservices (and heck, people can actually OWN them now!), and how not to design for the future (sharing via database is plain wrong and introduces terrible amounts of coupling). The only thing I wish was different is the title, it looks like it is trying to take advantage of the new buzzword, but to me, this seems like the second edition of M. Fowler’s “Patterns of Enterprise Software Architecture”. And that’s a must-read.
The Pragmatic Programmer of the microservices age. So many lessons learned the hard way is documented here. A quick and information-packed read.
A book that is more about ideas behind microservices and fine-grained systems than technology specifics.The key principles for microservice architectures:
– You want services that are loosely coupled and highly cohesive – so find boundaries that help ensure that related behavior is in one place and that communicate with other boundaries as loosely as possible.
– Avoid database integration
– Understand the trade-offs of REST and RPC, but strongly consider REST as a good starting point for request/response integration.
– Prefer choreography over orchestration.
– Avoid breaking changes and the need to version by understanding Postel’s Law and using tolerant readers.
– Think of user interfaces as compositional layers.
– Focus on maintaining the ability to release one service independently from another – you need one CI to build per microservice.
– If possible, move to a single-service per host/container.
– Automate everything.
– Optimize for fast feedback, and separate types of tests accordingly
– Avoid the need for end-to-end tests whenever possible by using consumer-driven contracts.
– Use consumer-driven contacts to provide focus points for conversation between teams.
– Understand the trade-off between putting more effort into testing and detecting issues faster in production (optimizing MTBF vs MTTR)
– It is preferable that teams aligned along with bounded contexts
– An essential part of building a resilient system is the ability to safely degrade functionality
– Prepare for the sorts of failure that can happen with distributed architectures. Handle failure by using timeouts, circuit breakers, bulkheads, and isolation
– Consider using blue/green or canary release techniques to separate deployment from release
– Use semantic monitoring to see if your system is behaving correctly, by injecting synthetic transactions into your system to simulate real-user behavior.
– Aggregate your logs, and aggregate your stats, so that when you see a problem you can drill down to the source.
I liked the cautionary tales and examples, as well as the idea of embracing the concept of evolutionary architecture, where your system bends and flexes and changes over time as you learn new things.
- Rosa Chaves Rodríguez:
A good introduction to the microservices World for the automatization defenders.
Microservices is still very young and this book does a fair job in covering all the aspects of the intricacies that involve adapting to it. I was expecting something different before I picked this book, however, most of the concepts elicited here are some of the known concepts to me as an Architect. It still has a lot of gold mines spread around the entire book. I would not say this is a must-read for a Software Architect, but the learnings of the book will definitely add value to your thinking process in designing fault-tolerant and large-scale systems. In any case, getting hands-on and having the first-person point of view is vital to really digest the things the author talks about.
- Chris Ford:
Sam Newman really knows what he’s talking about, and now you can too! If you’re thinking of adopting microservices at your organization, you could do a lot worse than adopt this book wholesale as your architectural strategy. Of course, you’ll always want to add your own touches, but if you want a safe place to start, read this ebook.
The ebook does a good job exposing the ideas and good practices behind migration to (micro)services. if you’ve been doing it for a while it’s a good way to checklist what you’ve done. If you’re jumping on the wagon it has a nice overview of the practices and the tools that are out there to help you. I feel that the chapter about Scaling gives a good summary of the whole ebook.
As other reviewers have said – the author is clearly a Java Junkie. But this does not change the fact that almost all of what is being said is relevant to System Architecture. AWS is used in various examples very well, and the process of converting a monolith into a set of microservices is overall well documented.
I think this book is going to be useful for any engineer onboarding the world of microservices. It gives a broad and complete overview of all stages of the process: from design to deployment and testing.On the other hand, from my perspective, for more experienced engineers already familiar with similar systems this book would rather look like a reiteration of all the difficulties and problems one might face while working with microservices. In many cases, the author agrees with the complexity of certain problems (e.g. database scaling/sharding, 2 phase commit, etc) but does not dive into details of how to approach these problems in the real world. However, this is probably intentional, as many of these problems go far beyond a single book.
In short: highly recommended to everybody dealing with the concepts of microservices for the first time ever.
A great introduction to building scalable systems employing microservices in complex domains. Essential reading for developers at any level, but especially for those involved in influencing any aspect of system architecture.
- Luís Soares:
If you have to readjust one book about microservices, choose this. Quick&easy to read but very complete; it summarizes related subjects (not only the technical ones). A book to read from beginning to end, but also one to consult. It mentions a lot of technologies, but never without the corresponding concept/topic so it’ll hardly get outdated. In the end, you just feel confident to develop this way.
- Lena Rakhimova:
I have used this book twice, when we split the monolith into smaller apps, and when we built microservices from scratch, it was very useful and handy to give directions to build the microservices. This book will not give a strict direction how-must-do but rather what-to-think-about to understand what challenges might come and possible solutions to handle them. All others depend on your own experience and sense of architecture therefore there is one chapter about who is an architect. I would recommend this book to read if you are going to build microservices and discuss it in your development group otherwise it will too theoretical and obvious.
- Regis Hattori:
This ebook shows a lot of aspects to consider before using microservices.It is hard to rate it because it is the first book I read about the topic. I really liked some parts, but I feel that the author did not put the same effort into other ones. There is not a consistent narrative among the topics. Some of them are focused on the concepts with detailed explanations. And some of them are more focused on tools.
- Krasimir Atanasov:
The book is a useful and practical guide on how to build and maintain a microservice architecture. Although it doesn’t go much deep in the specifics, it covers all aspects of such architecture and you can find many valuable takeaways. Some of the topics discussed are: when microservice architecture should/shouldn’t be used, splitting monolith applications, designing, deploying, testing, monitoring, and scaling microservices.
I was somewhat skeptical about the book. Microservices are hype and seem that everyone nowadays has their own advice on how to break the scary monolith. Still, I found this book very good. Apart from the concrete “break the monolith” subject, it addresses many common architectural – and in my opinion – much more important questions – about good software design, the art of decision making, coupling and cohesion, DDD, and much more. Technical advice and sum up of different tooling are also quite useful.
- Evan Wondrasek:
I took my sweet time with this one, but it was so darn good. (For a while, I was experimenting with only reading this book while riding a stationary exercise bicycle as motivation for exercise, which while somewhat effective, certainly highlights how little I’ve been exercising…)This book is solid wisdom. He favors breadth over depth, so much of this book is an overview of a complex topic with his advice and opinions, but mainly it’s a way to expose you to the tradeoffs present with every topic and gives you the space to experiment and figure out what works best for you. There’s usually not a single black and white answer to most challenges in distributed system design.
The thing I keep coming back to is his advice about not prematurely optimizing and instead favoring consistent iteration. There are some huge advantages of building something monolithic to start, learning and iterating on it while it’s still easy to change, and then refactoring into microservices as the domain and service boundaries become clearer. Separating concerns, defining clear service boundaries, and especially avoiding Conway’s law where systems often mirror the organizational structure of the team that built them. Yuck.
I also loved how modern this book was. The author clearly has spent a lot of time working with the big players in distributed systems like Netflix and AWS, and all the stuff we constantly talk about professionally was right here in this book – monitoring, reporting, fault tolerance.
I’ll read this again.
- Raul Mordillo:
in this ebook, I’ve found many useful tips for those wondering how Microservices architectures work, pain points, and ways to solve them.
Also, it gives you proper knowledge to decide whether or not your organization is prepared and ready to embrace Microservices.
- Дмитрий Виноград:
A good summary describing not only microservices but also covers a lot of trends in development.
- Anatoly Kaverin:
Probably the best book on the subject at the moment. A wide range of topics touched and lots of practices indeed work in real systems.
- Jean Tessier:
I worked with Sam a few years ago and I was curious to see what he’d been up to.Microservices are all the rage, right now. At work, I’ve been struggling with a monolith of my own. We cannot upgrade the technology stack because the task is just too big. Had we had a microservice-based approach, we would have had small pieces that we could have upgraded one at a time over time.
The most important characteristic of microservices is to minimize coupling between them so that the lifecycle of one is not tied to the lifecycle of any others. With an independent lifecycle, a microservice is free to evolve at its own pace. Finding the right boundaries between microservices is therefore critical. And the choice of integration technology can influence the options for implementing a microservice too.
The book gives a whirlwind tour of the wide array of techniques and technologies that can help you manage a simple service but become crucial when dealing with a large number of cooperating microservices. Some examples, in no particular order:
ELK (Elasticsearch, Logstash, Kibana)
Strangler pattern when replacing legacy systems
Netflix’s Simian Army
circuit breakers and bulkheads to contain failures
data pumps for aggregating data in data warehouses
RPC vs. event-based
Some of the anecdotes reminded me of experiences I’ve had a Google, some of the great and some of them less so. Overall, the book gives broad coverage of all the things you must keep in mind if you want to start using microservices. It does not provide in-depth coverage of any one topic, so you have to look elsewhere for direct implementation advice. The book does give you a number of places to start looking and the big picture view so you can see how the pieces fit together.
- Daniel Aguilar:
A superb introduction to software architecture, distributed systems, operations, resilience, scalability, and everything in between. It provides a very solid and extensive theoretic background to serve as the basis of current and future projects, discussing important principles that can and probably should be applied everywhere. It also provides many hypothetical as well as real-life examples in each chapter, and even though it is not at all the main goal of the ebook, it does indeed list some specific software solutions that can be used to apply the discussed ideas and techniques.Although it is an introductory ebook, it is not at all a short one. I repeatedly found myself going back to previous chapters to revise ideas I thought I had grasped well enough at first read. The author does a very good job at making it all easy to understand, but there are many topics that combine with each other, and maybe even more difficultly, they do so at different levels. Fortunately, as the author clearly suggests, adopting a microservices mindset/strategy is not (and should not be) a one-step, take-it-or-leave-it approach, but something one should keep in mind and apply it progressively there where it is most needed, conscious of its drawbacks and caveats, the most important of which he kindly reveals.