Awesome
awesome-microservice
A curated list of Microservice resources
Inspired by the awesome list thing.
Philosophy of Microservice
Origin of Microservice
Architectural Patterns(similar to book software-architecture-patterns from O`REILLY )
Core patterns
- Monolithic architecture from Chris Richardson
- Microservices architecture from Chris Richardson
- API Gateway from Chris Richardson
- Bounded Context from Martin Fowler
- Circuit Breaker from Martin Fowler
- Circuit Breaker ~ netflix
Deployment patterns
- Multiple service instances per host
- Service instance per host
- Service instance per VM
- Service instance per Container
Service discovery
- Client-side discovery from Chris Richardson
- Server-side discovery from Chris Richardson
- Service registry from Chris Richardson
- Self registration from Chris Richardson
- 3rd party registration from Chris Richardson
- Service discovery with consul & etcd
Debates between advantage and disvantage
- PaaS vs. IaaS for Microservices Architectures: Top 6 Differences
- PaaS与IaaS 在微服务架构实现方面的6大不同 PaaS vs. IaaS for Microservices Architectures: Top 6 Differences in Chinese
- O’Reilly Software Architecture Conference大会上对微服务架构的探讨总结
- Microservices Are Not a free lunch!
- The Hidden Costs of Microservices by Justin Leitgeb
Books About Microservice
- Antifragile: Things That Gain from Disorder
- The Black Swan
- Implementing Domain-Driven Design
- Building Micro Services - Sam Newman
- Building Micro Services - Sam Newman Downloadable preview edition
- Antifragile Software - Russ Miles
- software-architecture-patterns from O`REILLY in English
- software-architecture-patterns from O`REILLY in Chinese
- Production Ready Microservices - Susan J. Fowler
- Microservices in Production - Susan J. Fowler (free ebook)
- Microservices with Docker, Flask, and React - Michael Herman
Online Videos and Presentations
- Microservices - Martin Fowler
- State of the Art in Microservices - Adrian Cockcroft
- Deploying And Testing Microservices - Sam Newman
- Microservices Anti-Patterns
- Practical Considerations For Microservice Architectures - Sam Newman
- Migrating to Microservices - Adrian Cockcroft
- Microservices at Netflix
- Microservices: Adaptive Systems for Innovative Organizations
- Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
- Chris Richardson: Developing event-driven microservices with event sourcing and CQRS
- 微服务 在InfoQ上的内容
- Microservices on InfoQ website
Events
Best Practises from Industry
Articles and Blogs
- service principles from Yelp-A guide to service principles at Yelp for our service oriented architecture
- Adopting Microservices at Netflix serial 1: It’s Time to Move to a Four-Tier Application Architecture
- 第一部分:是时候转移到四层架构上来了/
- Adopting Microservices at Netflix serial 2: Adopting Microservices at Netflix: Lessons for Architectural Design
- 第二部分:微服务架构在Netflix的应用:架构设计的经验教训
- Adopting Microservices at Netflix serial 3: Adopting Microservices at Netflix: Lessons for Team and Process Design
- 第三部分:微服务架构在Netflix的应用:团队和流程设计相关的经验教训
- Microservices - A Reality Check(point)by Andrew Harmel-Law — on Development, Microservices, Java, Camel, NetflixOSS, Spring 17 Oct 2014
- Idempotency is not a Medical Condition - Pat Helland
- Martin Fowler - You Must Be This Tall To Use Microservices
- Adrian Cockroft - Migrating to Microservices
- Michael Nygaard - Stability Patterns, and Ant-Patterns…
- Eric Evans - Domain Driven Design: Tackling Complexity in the Heart of Software
- Uncle Bob - Microservices and Jars
- Steve Jones - Microservices - Money for old rope or re-badging SOA for the cool kids
- Sonu K. Meena - How to build microservice?
- Introduction to Microservices
- 微服务实战(一):微服务架构的优势与不足
- Building Microservices: Using an API Gateway
- 微服务实战(二):使用API Gateway
- Building Microservices: Inter-Process Communication in a Microservices Architecture
- 微服务实战(三):深入微服务架构的进程间通信
- 微服务实战(四):服务发现的可行方案以及实践案例
- Service Discovery in a Microservices Architecture
- Event-Driven Data Management for Microservices
- 微服务实践(五):微服务的事件驱动数据管理
- 0 to Microservice in 5 minutes with Go, go-microservice-template and Minke
- 5分钟学习基于Go,go-microservice-template,Minke的微服务
- IS REST BEST IN A MICROSERVICES ARCHITECTURE?
- REST真的完全适合微服务架构吗?
- Microservice架构模式简介
- 单元化与分布式架构的切分问题
- 一个单元化架构的例子
- Microservice微服务架构两年来在京东咚咚从理论到落地的实践总结
Example Projects
- Chris Richardson has published the example code for his QCONSF talk on building event-driven microservices. The example microservices-based application is built using event sourcing and command query responsibility separation (CQRS). There are currently two versions of the application - Scala/Spring and Java/Spring - with others to follow. Take a look!
- Building Microservices with Open Source Technologies by Suresh Balla
- 如何做实时监控?—— 参考 Spring Boot 实现
- 深入学习微框架:Spring Boot
- NetflixOSS Acme Air Sample and Benchmark
- Experiments With Docker For Acme Air Dev
- CRUD using Spring Data Rest and AngularJS using Spring Boot
- microservice of convert html to pdf
- Microservices tests with RabbitMQ and Docker
- A demonstration of a Microservices architecture using Spring Boot, Docker and Fig.
- Experiments with microservices and Docker
- Example code for my building and deploying microservices with event sourcing, CQRS and Docker presentation
- Some idea of how micro-services can be handled using SkyDNS, SkyDock and Docker
- This is a presentation on Docker held at FINN Architecture Summit - Service Orientation on 2015.01.21.
- Dummy project to try out new tools for me like Docker and RabbitMQ
- OAuth2 authentication server designed to work in a docker-based microservices architecture.
Library and Tools
People
- James Lewis
- Sam Newman
- Russ Miles
- Martin Fowler
- Chris Richardson
- Daniel Woods
Discussion Group
Many thanks to Owain Lewis and Chris Richardson i5ting
Notes :
Domain Driven Design & Microservices: An Approach to Modeling Microservices
Domain-Driven Design (DDD for short) and design patterns accompyning it has been used in the industry for over a decade to tackle complexity of enterprise software development. Domain-Driven Design concepts were introduced by Eric Evans in the seminal work in his book Domain-Driven Design: Tackling Complexity in the heart of Software, published in 2003. DDD principles are particularly well suited for Microservices Architrcture style. The DDD principles provide an approach to decompose an application and identify or right size a microservice.
DDD is an approach to software development for complex needs by connecting the implementation to an evolving model [2][5]. The premise of domain-driven design is the following: •placing the project's primary focus on the core domain and domain logic;
•basing complex designs on a model of the domain;
•initiating a creative collaboration between technical and domain experts to iteratively refine a conceptual model that addresses particular domain problems.
Domain-driven design is not a technology or a methodology. DDD provides a structure of practices and terminology for making design decisions that focus and accelerate software projects dealing with complicated domains [2] [5]. Let's define term domain before we look at DDD design patterns that help in building an application using Microservices Architecture.
Domain: It is a sphere of knowledge and activity around which the application logic revolves. It is what an organization does and the world it does it in.
DDD includes a set of design patterns that enable domain experts and software development teams to tackle complexity. The key patterns that apply to Microservices Architecture style are:
• Bounded Context: Bounded Context is a central pattern in Domain-Driven Design. It is the focus of DDD's strategic design section which is all about dealing with large models and teams. DDD deals with large models by dividing them into different Bounded Contexts and being explicit about their interrelationships.
• Ubiquitos Language: It is the practice of building up a common, rigorous language between developers and users, to connect all the activities of the team with the software. Every term has a precise and unambiguous definition. This language should be based on the Domain Model used in the software. It it used consistently in speech, documentation, diagrams and code.
• Aggregate: It is a cluster of domain objects that can be treated as a single unit. An aggregate will have one of its component objects be the aggregate root. Any references from outside the aggregate should only go to the aggregate root. The root can thus ensure the integrity of the aggregate as a whole. Aggregates are the basic element of transfer of data storage - you request to load or save whole aggregates. Transactions should not cross aggregate boundaries.
•Entitities: are objects which have an identity which remains the same throughout the states of the software. Entities must be distinguished from other similar objects having the same attributes by unique Identity (e.g. Joe's Bank Account). Entities in DDD have behavior (think of them as Business Objects with attributes and behavior in a domain).
Bounded Context, Aggregates and Microservices
Context: A context means a specific responsibility.
Bounded Context: A bounded context means that responsibility is enforced with explicit boundaries.
The core idea of Bounded Context is that any given domain consists of multiple bounded contexts, and residing within each are things (doman model & business logic/capability/functionality) that do not need to be communicated outside as well as things (domain model) that are shared externally with other bounded contexts. Each bounded context has an explicit interface, where it decides what models to share with other contexts, from Sam Newman in [7].
Given, a Bounded Context is “a specific responsibility enforced by explicit boundaries.”, if you want information from a bounded context, or want to make requests of functionality within bounded context, you communicate with its explicit boundary using models.
Bounded Context is widely considered to be a starting point and prime candidate for a microservice in microservice architecture:
•“One micro-service should cover one bounded context” - Vaughn Vernon.
•Sam Newman in [7] in chapter 3 - How to Model Services - uses a Bounded Context as the starting point for modeling a microservice
Key DDD principles of Ubiquitos Language, Aggregates, Aggregate Root and Entities - all reside and have a specific meaning within a Bounded Context.
Given microservices are organized around business capability, a Bounded Context is an excellent approach to modeling a microservice. While Bounded Context decouples domain logic, microservices decouple the technical decisions, performance, scalability, availability, robustness, security and so on. Since a Bounded Context has well-defined responsibility and explicit interface, it natually leads to less coordination and synchronization between teams and increases team velocity - all benefits very well-aligned with Microservices Architecture style.
Bounded contexts contain clusters of different data entities and processes that can control a significant area of functionality such as order fulfilment or inventory in an online ecommerce store. Hence depending on the domain, they can actually be quite large. A more finely grained DDD unit is the aggregate which describes a cluster of objects and behaviours that can be treated as a single cohesive unit. An aggregate is regarded as the basic unit of data transfer – a classic example is an order that contains a bunch of line items.
Aggregates [2] [4] have following properties:
•An Aggregate is a cluster of Entities and Value objects i.e. an Object Graph. Each aggregate is treated as one single unit.
•Aggregate boundary is transactional boundary i.e. Entities in an Aggregate are updated in one transaction.
•Each Aggregate has one root entity know as the Aggregate Root.
•The root identity is global, the identities of entities inside are local.
•External objects may have references only to root entity.
•Internal objects cannot be changed outside the Aggregate.
• An Aggregate can be modified from outside only via Aggregate Root.
•In distributed environment, keep an aggregate together on one server. Allow different aggregates to be distributed among nodes.
Given that an aggregate is a cohesive unit, it can be a reasonable indicator of the smallest meaningful scope for a microservice. It will be difficult to split an aggregate across service boundaries without compromising service autonomy. Thus Aggregates also serve as an excellent boundary for a microservice.
Choosing Aggregate as boundary of a microservice can lead to a very granular microservice and result in following problems:
•Tends to give rise to anaemic services that do little more than expose CRUD-style methods, degenerates to grouping data entities together rather than encapsulating business capabilities •Can lead to a very “chatty” service infrastructure where the majority of processing time is spent on remote calls between services
Aggregate as a boundary for a microservice is useful in domains where a bounded context is large or anytime you find a bounded context that is very large and there is a need to find a smaller boundary for a microservice.
Best Practice
A microservice i.e. single deployable unit or service should be no bigger than a bounded context, but no smaller than an aggregate. Start with relatively broad service boundaries to begin with, refactoring to smaller ones as time goes on.