4. Monoliths
• single deployment
• single runtime
• single codebase
• interaciton between classes is most often
syncrhonous
• most often every layer is in a separate
package
5. Microservices
• many small modules with specific functionality
• more than one codebase
• every microservice is a separate deployment
• every microservices has its own DB
• communication with web-
services/protobuf/thrift/…
• ensures module independence
7. Downsides of monoliths…?
• “spaghetti”, “big ball of mud”
• you need a full redeploy
• programmers often violate the layer
boundaries
• classes often “leak” their implementation
• hard to work with multiple teams
• hard to manage
8. Benefits of Microservices..?
• modelled around the business domain
• deployment automation culture
• hides implementation details
• decentralization
• option to use multiple languages
• separate deployment, separate monitoring
• isolating problems
10. Downsides of monoliths..?
• “spaghetti”, “big ball of mud”
• if you write bad code, architecture doesn’t matter
• you need a full redeploy
• so? It’s automated anyway
• programmers often violate layers
• see. 1
• classes “leak” their implementation
• see 1
11. Benefits of microservices..?
• all of them can be achieved with a monolith
• modelled around the business domain
• yes
• deployment automation culture
• nothing stops automated deployments of a monolith
• hides implementation details
• OOP 101
12. Benefits of microservices..?
• separate deployment, separate мониторинг
• monitoring of classes/components/layers with tools
like statsd
• isolating problems
• when has a single exception broken your server?
• if a whole machine dies – you have an HA cluster
• graceful degradation - feature toggle in monolith
13. Microservices...downsides
• network overhead
• transaction coordination
• you don’t have transaction? Congratulations.
• need for duplicating common data
• and keeping it in sync
• complicated deployment pipeline
• dependencies
14. Microservices...should we?
“…don’t even consider microservices unless
you have a system that’s too complex to
manage as a monolith. The majority of software
systems should be built as a single monolithic
application. Do pay attention to good modularity
within that monolith, but don’t try to separate it
into separate services” Martin Fowler
15.
16. “the design thinking and decomposition
strategy required to create a good
microservices architecture are the same as
those needed to create a well structured
monolith” Simon Brown
18. How to write monoliths
• package by layer (small projects)
• with sub-packages by component
• package by components
• logically the same as microservices, without the cons
• one or several projects with module dependencies
• project jigsaw - modules
• good OOP
• interfaces, encapsulation, composition, etc.
19. More best practices
• Continuous delivery, automation
• High availability
• Log collection
• Monitoring
20. Microservices use cases
• multiple teams
• short-lived, spawned workers
• memory or CPU intensive parts
• to ease development
21. Но като цяло...
• common sense
• добри практики
• качествен код
• не се доверявайте на “модерното”
• не се “наархитектурчвайте”
• a.k.a. KISS
• загубите може да са повече от евентуалните
ползи