A introduction to Microservices Architecture: definition, characterstics, framworks, success stories. It contains a demo about implementation of microservices with Spring Boot, Spring cloud an Eureka.
2. ABOUT ME
• Senior Software Developer at Sqli Group Rabat Morocco
• JAVA / OCEJWCD & HYBRIS certified
• I worked in many E-Commerce projects based on SAP
Hybris Platform
• @abdelghaniazri
26/05/2016 Sqli Group 2
3. SUMMARY
• INTRODCUTION & HISTORY
• WHAT IS MICROSERVICES ARCHITECTURE?
• CHARACTERISTICS OF MICROSERVICES
• BENEFITS OF MICROSERVICES
• REQUIREMENTS FOR MICROSERVICES
• WHO HAS USE THEM ?
• MICROSERVICES PATTERNS
• FRAMEWORKS FOR MICROSERVICES
• BUILDING MICROSERVICES ARCHITECTURE
• DEMO
• REFERENCES
26/05/2016 Sqli Group 3
6. MONOLITHICALAPPLICATIONS
• The term Monolothic Used by Unix community and
appears first time in The Art of Unix Programming
• It describe a big application
• Single-tiered software application in which the user
interface and data access code are combined into a
single program from a single platform. (Wikipedia)
26/05/2016 Sqli Group 6
7. MONOLITHICALAPPROACH PROS
• Single codebase
• Easy to develop/debug/deploy
• Good IDE support
• Easy to scale
• A Central Ops team can efficiently handle
26/05/2016 Sqli Group 7
8. MONOLITHICALAPPROACH
DRAWBACKS
• Large Codebase
• Many Components, no clear ownership
• Long deployment cycles
• As codebase increases …
• Tends to increase “tight coupling” between components
• All components have to be coded in the same language
26/05/2016 Sqli Group 8
10. HISTORY
• The term « microservice » appeared firstly in 2011 in
software architecture workshop near Venice
• In Mai 2012: “Java, the Unix Way” at 33rd degree by
James Lewis
• September 2012: “μService Architecture“ at Baruco by
Fred George
• Adrian Cockroft at Netflix« FINE GRAINED SERVICES »
Source: http://martinfowler.com/articles/microservices.html#footnote-etymology
26/05/2016 Sqli Group 10
11. DEFINITION
• No concret definition.
• Microservices is not SOA
• Microservices is an architecture style
• Large complex software applications are composed of
[1..n] Small services
• Each of them complets one task
• Each task represent a small business capability
• Bounded context
26/05/2016 Sqli Group 11
13. COMPARISON
MONOLITHICAL VS MICROSERVICES
Category Monolithic architecture Microservices architecture
Code Single code base Multiple code base.
Each microservice has its
own code base
Understandability Often confusing and hard to
understand
Much better readability
And easier to maintain
Deployment Complex deployments with
maintenance windows and
scheduled downtimes.
Simple deployment as each
microservice can be
deployed individually, with
minimal if not zero downtime.
Language Typically entirely developed in
one programming language.
Each microservice can be
developed in a different
programming language.
Scaling Requires you to scale the
entire application even though
bottlenecks are localized.
Enables you to scale
bottle-necked services
without scaling the entire
application.
26/05/2016 Sqli Group 13
14. OPERATIONAL REQUIREMENTS FOR
MICROSERVICES
• DOMAIN DRIVEN DESIGN
• Eric Evans’ DDD approach
• Anemic domain model = database tables mapped to objects. No
behavior
• Rich domain model = a collection of objects that expose behavior
26/05/2016 Sqli Group 14
15. OPERATIONAL REQUIREMENTS FOR
MICROSERVICES
• SINGLE RESPONSIBILITY PRINCIPLE
• Each service is responsible for a single part of the functionnality
and does it well
26/05/2016 Sqli Group 15
16. OPERATIONAL REQUIREMENTS FOR
MICROSERVICES
• EXPLICITY PUBLISHED INTERFACE
• A producer service publishes an interface that is used by a
consumer service
26/05/2016 Sqli Group 16
17. OPERATIONAL REQUIREMENTS FOR
MICROSERVICES
• INDEPENDENT DURS
• DEPLOY,UPDATE,REPLACE,SCALE
• Each service can be independently deployed, updated, replaced
and scaled
26/05/2016 Sqli Group 17
18. OPERATIONAL REQUIREMENTS FOR
MICROSERVICES
• LIGHT WEIGHT COMMUNICATION
• REST over HTTP
• STOMP over WebSocket
• Other similar lightweight are used for communication between
services
26/05/2016 Sqli Group 18
20. BENEFITS OF MICROSERVICES
• INDEPENDENT SCALING
• Each microservice can scale independently
• INDEPENDENT UPGRADES
• Each microservice can deployed independently
• Teams are independent
• EASY MAINTENANCE
• Each microservice does one feature : code more readable
• POTENTIAL HETEROGENEITY AND POLYGLOTISM
• Teams may have # platform, language
• FAILURE AND RESOURCE ISOLATION
• If one service crash, it will not affect the rest of application
• IMPROVED COMMUNICATION ACROSS TEAMS
• Membres of domain work in single team
26/05/2016 Sqli Group 20
23. MICROSERVICES PATTERNS
• Proxy:
The Proxy microservice design pattern is a variation of the
Aggregator. In this case, aggregation does not need to
happen client-side. Rather, a different microservice may be
invoked as required by the business logic.
26/05/2016 Sqli Group 23
26. MICROSERVICES PATTERNS
• Shared Resources:
• the service is full-stack and has control of all the
components UI, middleware, persistence, transactions.
This allows the service to be polyglot, so the right tool can
be used for the right job
26/05/2016 Sqli Group 26
27. MICROSERVICES PATTERNS
• Asynch Messaging:
Since Rest is synchronous, Some services elect to use
message queues instead of REST: RabbitMQ, ActiveMQ…
26/05/2016 Sqli Group 27
28. WHO HAS USE THEM ?
• Great success in some big systems
• ThoughtWorks
• Netflix
• Amazon
• REA Group
• Soundcloud
• eBay
• Google
• …
26/05/2016 Sqli Group 28
29. JAVA FRAMEWORKS FOR
MICROSERVICES
• Spring Boot
• Dropwizard
• Jersey
• Ninja Web Framework
• Play Framework
• RestExpress
• Restlet
• Restx
• Spark Framework
• …
26/05/2016 Sqli Group 29
30. OTHER FRAMEWORKS
• Flask (python)
• Sinatra (Ruby)
• Vert.x (Polyglotte)
• Service Fabric (DOT NET)
26/05/2016 Sqli Group 30
31. BUILDING MICROSERVICES
ARCHITECTURE
• Conway’s law
• Invented by the computer programmer M. Conway's in 1967
• organizations which design systems ... are constrained to produce
designs which are copies of the communication structures of these
organizations
26/05/2016 Sqli Group 31
45. SUMMARY
• Microservices: functional decomposition of systems into
manageable and independently deployable services
• Microservices is not SOA
• Microservices can be seen as “SOA – the good parts”
• Will microservices help me ??
• Domain modeling, boundaries, runtime dependencies, loose coupling
& culture/organizational structure
• Microservice architectures means
• Independence in code, technology, scaling, evolution
• Using battle-tested infrastructure (HTTP, JSON, REST)
26/05/2016 Sqli Group 45