SlideShare a Scribd company logo
How to grow your own
Microservice?
Dmitry Buzdin
Started a small consultancy company
• DevOps
• Test Automation
• Software Architecture
• Java/JVM
• Other Stuff: Agile/Web/Mobile
@buzdin
About Presenter
Agenda
• Why (not) microservices?
• Modular architecture
• Micromodule architecture
• Migrating to microservices
• Practical Advices
Welcome to the Wonderful World
of Microservices!
Microservices
https://martinfowler.com/articles/microservices.html
Splitting your system into
manageable, self-sufficient
services
http://microservices.io/
Why Microservices?
• Delivering value faster
• Easier to maintain then monolith
• Easier to change tech stack
• Easier to replace parts of your system
• More scalable
Monolith First
https://martinfowler.com/bliki/MonolithFirst.html
Why not Microservices?
• Difficult to move functionality between services
• Sophisticated DevOps rituals
• Infrastructure overhead
• Distributed communication
• Transactional boundaries
eBay Architecture
• Perl MVP in 1995
• C++ DLL with 3,4 mil single dll in ~2005
• Java services later
• Polyglot microservices now
http://highscalability.com/blog/2015/12/1/deep-lessons-from-google-and-ebay-on-building-ecosystems-of.html
Took 20 years,
1000s of devs
And billions of $
How do you start and improve an
Evolutionary Architecture?
Modular Architecture
What is a Module?
• Can be reused as a separate file
• Has bootstrapping functionality
• Could be developed/compiled separately
• Depends on libraries/frameworks/modules
Reasons for Modules to Exist
• Reusable utility classes
• Platform plugins
• Client APIs
• Service API implementation modules
• Others?
Modular Architecture
Some Good Patterns
https://dzone.com/refcardz/patterns-modular-architecture
Modularity Breaking Bad
and more useful advices…
Module Hell
• Module overengineering - module per-layer/per-
logical-component anti-pattern
• Fake modules - can not be deployed or tested
independently
• Interdependent modules
Reuse Release Equivalence Principle
http://wiki.c2.com/?ReuseReleaseEquivalencePrinciple
How to use modules properly?
Micromodules Architecture
Splitting your system into
manageable, self-sufficient
services modules
Bounded Context
https://martinfowler.com/bliki/BoundedContext.html
Bounded Context Module
Database Schema
Persistence Layer
Application Layer
API (Local)
Lots of micromodules are
deployed together
Micromodules
• Micromodules can be started and tested independently
• Deployed on same technological platform
• Runs in a single process/VM
• One or multiple deployable artifacts in the end
Same Storage
• Common database for many micromodules
• Separate schema for every bounded context
• Compatible approach for schema migrations
Module Types
• Bounded context (documents, users, payments)
• Aggregates
• Service provider interface modules
• Third-party integrations
• API Facade
• Client API
• Products
Modular Monolith
CRM CMS Payments
CRM CMS Payments
AdminMarketing
API
Facade
Database
Application
Payment
Gateway
Bank X
Gateway
Client
API
My
Product
Config
Microservice Extraction
CMS Payments
CRMCMS Payments
AdminMarketing
REST
Facade
Payment
Gateway
Bank X
Gateway
My
Product
Config
CRM
CRM
Product
REST
Facade
Config
Thinking in Modules
• Run all on local machine
• Keep modules small and self-contained
• Deliver modules fast
• Rewrite later
Why Extraction?
• Common service for different products
• Separate frequency of deployments
• Completely different usage patterns
• Deployment topology changes
• Scalability reasons
• Security reasons
Product Modules
• Product specific features
• Product specific schema
• Single branch - multiple products
• Product == Deployment unit
Growing Microservices
STAGED APPROACH
• There is no defined “architecture”
• Modules come and go
• Some modules are upgraded to microservices
• Improvements is a constant process
MICROSERVICE INCUBATION STAGES
Application
Core & Payments
Application
Payments
Core
RabbitMQ
Payments ServiceApplication
PaymentsCore RabbitMQ
0 1 2
3
Application
Payments
Core
In-Process Java API
Database
SEPARATION TO “MICRODATABASES”
Core
Core
0
2
Payments
Payments
Database
Core
Core
Payments
Payments
DatabaseDatabase
Core
Core
Payments
Payments
1
EVENTUAL CONSISTENCY
REFACTORING TO MICROSERVICES
• Staged refactoring approach would increase
confidence and success rate significantly
• Every “iteration” of changes ends up in a release and
being tested together with the product
• Existing code gets refactored
• Possibility to stop and re-plan at any time
Practical Advices
Don’t Write Reusable Frameworks
• Keep technical reusable code to minimum
• Reuse open sources packages
• Minimal common platform code
API-First Design
• Sync/Async
• REST API
• Event-based
• Test-driven development
• Documented (Swagger, RAML, ProtoBuf,
json-schema)
Do Not Expose Internals
• API contract annotations with generated client
• Defensive coding and validation in the service
• Event-based decoupling
• Do not expose persistent objects
Persistence
• ORM - data preparation and updates
• Direct SQL - read-only data retrieval and
aggregation
Schema per Bounded Context
• It is ok to have a lot of schemas in a single DB
• Schemas ensure logical data separation
• Cross-schema requests are possible
• Security control on schema level, not on table level!
Data Modeling
• No foreign keys between different bounded contexts
• Simple data structures - use JSON if required
• No deletes, few updates - insert only
• Everything is auditable
SQL/NoSQL
• PostgreSQL
• Relational data model (sql)
• Property based (jsonb)
• Key-value (hstore)
• Full-text search
Testing
• Integration testing is a must
• Relaxed approach to unit testing
• Docker for testing and local dev
• Acceptance testing is great, but expensive!
DevOps
• Automated Jenkins Pipelines
• Dev -> Test -> Stage -> Prod
• One-click deployments
• Limited use of Nexus/Artifactory (artifact in pipeline)
Kubernetes
• Becomes the default platform for
microservices
• Managed platform on Cloud – maybe ok
• Local installation, or manual support – think
twice!
Summary
Micromodules
• Same benefits as micro services, except
scalability and hybrid technologies
• Greatly reduced complexity
• On-demand upgrade to micro services
Start using micromodules now!
Migrate to micro services later, when you have lots of
money, devops and teams
How to grow your own Microservice?

More Related Content

PDF
Delivery Pipeline for Windows Machines
PDF
How to Build Your Own Test Automation Framework?
PDF
Testing Angular
PPTX
Jbehave selenium
PPTX
Tech io spa_angularjs_20130814_v0.9.5
PPT
Java Basics for selenium
PPTX
Testing Java EE apps with Arquillian
PPTX
Marcin Wasilczyk - Page objects with selenium
Delivery Pipeline for Windows Machines
How to Build Your Own Test Automation Framework?
Testing Angular
Jbehave selenium
Tech io spa_angularjs_20130814_v0.9.5
Java Basics for selenium
Testing Java EE apps with Arquillian
Marcin Wasilczyk - Page objects with selenium

What's hot (20)

PPTX
Php unit for drupal 8
PPT
Selenium Architecture
PPT
Introduction tomaven
PPTX
Integration Testing with Selenium
PPTX
TGT#13 - UI Tests Automation Framework in Evolve EDM – Case Study - Mateusz R...
KEY
Fun with EJB 3.1 and Open EJB
PPTX
Microsoft Fakes, Unit Testing the (almost) Untestable Code
PPTX
Hibernate performance tuning
PPTX
Unit Testing in Swift
PPTX
ASP.NET security vulnerabilities
PPTX
How to write test in node.js
PPT
Java build tool_comparison
PDF
Continuous integration using thucydides(bdd) with selenium
PPTX
Automated Testing using JavaScript
PPTX
Structured Functional Automated Web Service Testing
PPTX
Exactpro Systems for KSTU Students in Kostroma
PPTX
Thucydides – next generation acceptance testing with WebDriver
PPTX
Automation solution using jbehave, selenium and hudson
PPTX
Batching and Java EE (jdk.io)
PPTX
Системный взгляд на параллельный запуск Selenium тестов
Php unit for drupal 8
Selenium Architecture
Introduction tomaven
Integration Testing with Selenium
TGT#13 - UI Tests Automation Framework in Evolve EDM – Case Study - Mateusz R...
Fun with EJB 3.1 and Open EJB
Microsoft Fakes, Unit Testing the (almost) Untestable Code
Hibernate performance tuning
Unit Testing in Swift
ASP.NET security vulnerabilities
How to write test in node.js
Java build tool_comparison
Continuous integration using thucydides(bdd) with selenium
Automated Testing using JavaScript
Structured Functional Automated Web Service Testing
Exactpro Systems for KSTU Students in Kostroma
Thucydides – next generation acceptance testing with WebDriver
Automation solution using jbehave, selenium and hudson
Batching and Java EE (jdk.io)
Системный взгляд на параллельный запуск Selenium тестов
Ad

Similar to How to grow your own Microservice? (20)

PPTX
Tokyo Azure Meetup #5 - Microservices and Azure Service Fabric
PPTX
Micro service session 1
PPTX
Microservices in Azure
PPTX
Pros & Cons of Microservices Architecture
PPTX
Introduction to Microservices
PPTX
Microservices in Azure
PDF
Microservices - opportunities, dilemmas and problems
PPTX
Iot cloud service v2.0
PDF
Stay productive_while_slicing_up_the_monolith
PPTX
Microservices, Spring Cloud & Cloud Foundry
PDF
Closer Look at Cloud Centric Architectures
PPTX
Microservice intro
PPTX
Exploring microservices in a Microsoft landscape
PPTX
Microservices and Best Practices
PPTX
Neotys PAC - Ian Molyneaux
PDF
170215 msa intro
PPTX
Service fabric overview
PPTX
Grokking microservices in 5 minutes
PPTX
Concurrency at Scale: Evolution to Micro-Services
PPTX
Serverless: The future of application delivery
Tokyo Azure Meetup #5 - Microservices and Azure Service Fabric
Micro service session 1
Microservices in Azure
Pros & Cons of Microservices Architecture
Introduction to Microservices
Microservices in Azure
Microservices - opportunities, dilemmas and problems
Iot cloud service v2.0
Stay productive_while_slicing_up_the_monolith
Microservices, Spring Cloud & Cloud Foundry
Closer Look at Cloud Centric Architectures
Microservice intro
Exploring microservices in a Microsoft landscape
Microservices and Best Practices
Neotys PAC - Ian Molyneaux
170215 msa intro
Service fabric overview
Grokking microservices in 5 minutes
Concurrency at Scale: Evolution to Micro-Services
Serverless: The future of application delivery
Ad

More from Dmitry Buzdin (20)

PDF
How Payment Cards Really Work?
PDF
Как построить свой фреймворк для автотестов?
PPTX
Big Data Processing Using Hadoop Infrastructure
PDF
JOOQ and Flyway
PDF
Developing Useful APIs
PPTX
Whats New in Java 8
PPTX
Архитектура Ленты на Одноклассниках
PDF
Dart Workshop
PDF
Riding Redis @ask.fm
PDF
Rubylight JUG Contest Results Part II
PDF
Rubylight Pattern-Matching Solutions
PDF
Refactoring to Macros with Clojure
PPTX
Poor Man's Functional Programming
PDF
Rubylight programming contest
PPTX
Continuous Delivery
PPTX
Introduction to DevOps
PDF
Thread Dump Analysis
PDF
Pragmatic Java Test Automation
PDF
Mlocjs buzdin
PDF
Web polyglot programming
How Payment Cards Really Work?
Как построить свой фреймворк для автотестов?
Big Data Processing Using Hadoop Infrastructure
JOOQ and Flyway
Developing Useful APIs
Whats New in Java 8
Архитектура Ленты на Одноклассниках
Dart Workshop
Riding Redis @ask.fm
Rubylight JUG Contest Results Part II
Rubylight Pattern-Matching Solutions
Refactoring to Macros with Clojure
Poor Man's Functional Programming
Rubylight programming contest
Continuous Delivery
Introduction to DevOps
Thread Dump Analysis
Pragmatic Java Test Automation
Mlocjs buzdin
Web polyglot programming

Recently uploaded (20)

PDF
System and Network Administraation Chapter 3
PPTX
Materi-Enum-and-Record-Data-Type (1).pptx
PPTX
Introduction to Artificial Intelligence
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Digital Strategies for Manufacturing Companies
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
System and Network Administration Chapter 2
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
top salesforce developer skills in 2025.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Complete React Javascript Course Syllabus.pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
System and Network Administraation Chapter 3
Materi-Enum-and-Record-Data-Type (1).pptx
Introduction to Artificial Intelligence
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Digital Strategies for Manufacturing Companies
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
ISO 45001 Occupational Health and Safety Management System
System and Network Administration Chapter 2
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Wondershare Filmora 15 Crack With Activation Key [2025
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
VVF-Customer-Presentation2025-Ver1.9.pptx
top salesforce developer skills in 2025.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Complete React Javascript Course Syllabus.pdf
Odoo POS Development Services by CandidRoot Solutions
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises

How to grow your own Microservice?