When someone wants to learn about Microservice, s/he can easily get lost in the jungle of buzzwords. Specially the relationship between Domain Design, Service to Service communication and Devops are used very frequently in Microservice. But which is what and how are they fit together?
I tried to discuss them in my presentation.
Video can be found here: https://www.youtube.com/playlist?list=PLEYpvDF6qy8YyX2dQX93C88mQ5alaWFXJ
2. Topics
• What is Microservices
• Why we need Microservices
• Design a single service
• Building blocks of a Microservice System
• What’s next
3. @Me
• Foyzul Karim
• Started journey on 2009
• Details on LinkedIn [linkedin.com/in/foyzul]
• Love to make videos [youtube.com/foyzulkarim]
• Love to contribute open source [github.com/foyzulkarim]
• Love to contribute on Facebook [facebook.com/foyzulsacademy]
5. Brief history
• The term "microservice" was discussed at a workshop of software architects near Venice in
May 2011 to describe what the participants saw as a common architectural style that many of
them had been recently exploring.
• In May 2012, the same group decided on "microservices" as the most appropriate name.
James Lewis presented some of these ideas as a case study in March 2012 at 33rd Degree in
Krakow in Microservices - Java, the Unix Way as did Fred George about the same time.
• Adrian Cockcroft at Netflix, describing this approach as "fine grained SOA" was pioneering the
style at web scale as were many of the others mentioned in this article - Joe Walnes, Daniel
Terhorst-North, Evan Botcher and Graham Tackley.
• Article link: https://martinfowler.com/articles/microservices.html
6. Microservices
• In short, the microservice architectural style is an approach to developing a single
application as a suite of small services, each running in its own process and
communicating with lightweight mechanisms, often an HTTP resource API.
• These services are built around business capabilities and independently
deployable by fully automated deployment machinery.
• There is a bare minimum of centralized management of these services, which may be
written in different programming languages and use different data storage
technologies.
-- James Lewis and Martin Fowler (2014)
[https://martinfowler.com/articles/microservices.html]
8. Characteristics of a Microservice System
• Microservices - also known as the microservice architecture - is an architectural style
that structures an application as a collection of services that are
• Highly maintainable and testable
• Loosely coupled
• Independently deployable
• Organized around business capabilities
• Owned by a small team
• The microservice architecture enables the rapid, frequent and reliable delivery of
large, complex applications. It also enables an organization to evolve its technology
stack.
11. Why we need Microservices? Why now?
• Single vendor lockdown era is over
• Different database for different purpose
• Different programming stack for different purpose
• Different software architecture for different purpose
• Scaling is not more multiplying the whole server
• Containers (Lxc, Lxd, Docker etc.)
• Orchestrators (Kubernetes)
• Cloud computing era is in full swing
• Can choose different cloud service in different microservice
• We don’t have luxury to go offline for a minute now a days
• No more outage because of a problematic service
13. Designing a single micro-service
• Define the domain boundaries
• Follow Single Responsibility Principal in every level
• Select appropriate tech stack
• Choose programming stack
• Choose database
• Database can only be accessed by it’s parent service
• Expose the api endpoints to be consumed by other services
• Should independently handle the request
• Adapt the architecture for the whole microservices system
Service
DB
15. Building blocks of a Microservices System
• Service to service communication
• Client to service communication
• Service discovery
• Service security
• Service monitoring
• Service containerization
• Service orchestration
• Continuous integration
• Continuous delivery
16. Service to service communication
• Point to point communication
• HTTP request
• gRPC request
• Asynchronous message-based communication
• Queue
• Service Bus
24. Service security
• Authentication server
• Handles different types of authentication
• Token based
• Cookie based
• Authorization server
• Fully functional RBAC management system
• Returns true/false depending on the resource request
26. Service containerization
• Multiple service to use multiple types of resources
• Different operating system (Linux, Windows etc.)
• Different programming language (C#, Python, JavaScript etc.)
• Different database (SQL Server, MySQL, MongoDB, ElasticSearch etc.)
• Different package versions
• We need the runtime and a thin OS layer to execute the system calls
• Containers here to rescue
• Pack the service (containerize)
• Run it anywhere
• Docker
27. Service orchestration
• How to build the containers in multiple environments
• How to run the containers in multiple environments
• How to monitor the containers after deployment
• How to troubleshoot the containers
• Kubernetes, Docker Compose etc.
The term "microservice" was discussed at a workshop of software architects near Venice in May, 2011 to describe what the participants saw as a common architectural style that many of them had been recently exploring. In May 2012, the same group decided on "microservices" as the most appropriate name. James presented some of these ideas as a case study in March 2012 at 33rd Degree in Krakow in Microservices - Java, the Unix Way as did Fred George about the same time. Adrian Cockcroft at Netflix, describing this approach as "fine grained SOA" was pioneering the style at web scale as were many of the others mentioned in this article - Joe Walnes, Daniel Terhorst-North, Evan Botcher and Graham Tackley.