SlideShare ist ein Scribd-Unternehmen logo
1 von 47
Microservices… Yes or not?
Eduard Tomàs – Dev @ Plain concepts
@eiximenis
http://geeks.ms/etomas
#Gapand2017
Colaboradores
How we
reach here?
N-tier apps
• Distributed aplications
• Implicit boundaries
• RPC-like
Common Object Request Broker
Architecture
DCOM & DNA Architecture
RMI
…
SOA
• Services have explicit
boundaries
• Services are autonomous
• Services share schema and
contract, not classes
• Services interoperate based
on policy
“Four SoA Tenets” by Don Box
• OASIS Web Services
• WS-*
• SOAP
• Enterprise Service Bus (ESB)
• WebSphere ESB
• BizTalk
• Oracle ESB
• …
Don Box @ Teched 2001 (BCN)
Microservices
The term "Microservice Architecture" has sprung up over the last few years to
describe a particular way of designing software applications as suites of
independently deployable services. While there is no precise definition of this
architectural style, there are certain common characteristics around organization
around business capability, automated deployment, intelligence in the endpoints,
and decentralized control of languages and data.
https://martinfowler.com/articles/microservices.html
Microservices - also known as the microservice
architecture - is an architectural style that structures an
application as a collection of loosely coupled services,
which implement business capabilities. The microservice
architecture enables the continuous delivery/deployment
of large, complex applications. It also enables an
organization to evolve its technology stack.
SOA vs Microservices
SOA Microservicios
Services are generally big Services are generally small
ESB centric role Usually no need for ESB
Favours orchestration over coreography Favours coreography over orquestration
Share as much as possible Share as Little as posible
OASIS WS-*, SOAP, XML, HTTP, … REST, HTTP, …
Who cares about SOA now? Everybody talks about Microservices!
Just one comparison…
But, the reality is…
https://www.youtube.com/watch?v=wgdBVIX9ifA
Microservices are a way to do SOA
SOAP vs REST
• Heavy message format: XML
and <soap:Envelope> schema
• RPC based: service -> method
(i.e. doctorSvc->GetAllPatients)
• Uses HTTP merely as transport
protocol. Can use other
transports.
• Small messages. No format
assumed
• Resource based (i.e.
/doctors/<id>/patients
• Embraces HTTP semantics: use
HTTP verbs and return codes
Orchestration
• Main logic business belongs to a
single central service (the
orchestrator)
• Central service calls other services
and combines its results
• Typical example: BPEL process
Coreography
• Logic distributed.
• No central point that coordinates
other services
• Best with event source model
The 8 key aspects of Microservices (by
Fowler)
1. Componentization via Services
2. Organized around Business Capabilities
3. Products not Projects
4. Smart endpoints and dumb pipes
5. Decentralized Governance
6. Decentralized Data Management
7. Infrastructure Automation
8. Design for failure
https://martinfowler.com/articles/microservices.html
The 7 sins of Microservices
• LUST: Using the latest & greatest tech
• GLUTTONY: Excessive communication protocols
• GREED: All your Service are belong to us
• SLOTH: Creating a distributed monolith
• WRATH: Blowing up when bad things happen
• ENVY: The shared single domain fallacy
• PRIDE: Testing in the world of transcience
https://opencredo.com/the-seven-deadly-sins-of-microservices-redux/
LUST
• Do not believe that using the latest
tech will solve all your problems
• Docker, k8s, Terraform, Swarm are
great technologies
• But sometimes the right choice is to
pick some old and boring techs
GLUTTONY
• HTTP, Protobuff, AMQP, 0MQ,
gRPC, MQTT, …
• All are great communication
protocols…
• …But not all together!
• Choose one synchronous
protocol…
• … And an asynchronous one
GREED
• Organization needs to adapt a
“microservices culture”
• Each microservice belongs to
specific team
• Deployment, technologies & tools,
processes… are team
responsabilities
SLOTH
• If you don’t change your mind and
develop each microservice with
using same patterns and decisions
used to create monoliths
• You’ll finish not having
microservices at all. Instead...
• You’ll have a set of microservices
that can’t be deployed and updated
independently
WRATH
• Failure happens all of time
• Must embrace DevOps mentality of
shared understanding and
responsibility
• Rapid provisioning, monitoring and
deployment are mandatory pre-
requisites
ENVY
• Using a Shared Single Domain is
OK when developing a monolith
• In microservices is better to follow
the DDD concept of ‘bounded
context’ to encapsulate better our
services
• Anyway: there is no rule. Don’t
assume that one bounded context
== one microservice
PRIDE
• Testing microservices is often
harder (or much harder) than
testing a monolith
• Test as much as you can in your
CI/CD pipelines
• Unit tests, integration tests,
component tests, end-to-end
tests. Automate them all.
12 factor
apps
https://12factor.net/
I - Codebase
• One codebase, many deploys
• If there is more than one
codebase, it is not an app, it is a
distributed system
II - Dependencies
• Explicity declare and isolate dependencies
• 12 factor app never relies on the existence of “system-wide” packages
• All dependencies are declared by the app…
• … and a dependency isolation tool is required also
III - Config
• Store config in the environment
• Configuration vary between deploys. So can’t be part of the app
• Try to avoid config files, and never store them to repo
• Store configuration in environment variables
IV – Backing services
• A backing Service is any external Service consumed by the app
(database, rabbitmq, external mail service,…)
• App must make not distinction between local and 3rd party backing
services
• All backing services are just attached resources that can be accessed
through an URI
• Any backing Service can be changed from local to 3rd party at any
time, only changing configuration
V – Build, Release, Run
• Strictly separate the build & run stages
• A codebase is transformed to a deploy through 3 stages
• Build stage: Creating an executable from source code
• Release stage: Deploying the executable to specific environment and apply
config
• Run stage: Starts the app by starting specific executables on the environment
• These 3 stages must be completely isolaged (i. e. can’t change the
code during run or release stages)
VI - Processes
• Execute the app as one or more stateless processes
• Any app is stateless and share nothing. Any state must be stored in a
stateful backing Service
• Using local storage and/or memory is OK, only if it used as a cache in
a single request lifetime
• Sticky sessions are (of course) a violation of 12 factor apps
VII – Port binding
• Expose Services via port binding
• A 12 factor app is completely self-contained
• No runtime injection of any webserver or similar is allowed
• App expose its functionality using a configurable port
VIII - Concurrency
• Scale out via process model
• In 12 factor apps process is a 1st class citizen
• Scale using more processes, instead of any other way (like threads)
• As 12 factor apps are stateless and share nothing, concurrency and
scale using processes is a safe and simple operation
IX - Disposability
• Maximize robustness with fast startup and graceful shutdown
• 12 factor apps are disposable: can be stopped at any momento
• App must shutdown gracefully at SIGTERM
• App should be robust when a sudden death happen (i. e. hardware
failure)
X – Dev / prod parity
• Keep development, staging, and production as similar as possible
• App must be designed for Continuous deployment in mind: gap
between prod and dev must be as small as posible
• Code authors are code deployers. No “deployment team”
XI - Logs
• Treat logs as event streams
• A twelve-factor app never concerns itself with routing or storage of its
output stream
• App never manages its logfiles: just log to the stream
• Environment maps the stream wherever appropiate
XII – Admin processes
• Run admin/management tasks as one-off processes
• One-off admin processes should be run in an identical environment as
the regular long-running processes of the app.
• Admin code must ship with application code to avoid synchronization
issues.
When to use
microservices?
Microservices are not a free lunch!
• Significant Operations Overhead
• Substantial DevOps Skills Required
• Implicit interfaces management
• Duplication Of Effort
• Distributed System Complexity
• Asynchronicity Is Difficult!
• Testability Challenges
So… when to use them?
• If your organization has a strong devops culture
• Microservices allow to break a very big monolith in small pieces. Each
piece can be managed by one pizza team.
• Microservices biggest advantage is agility: you can update, test and
deploy each microservice in an independent way.
Agility in Microservices
• Amazon is a heavy user of microservices
• A single shop product use case can interact with 100+ microservices
• Amazon deploy to production…
• Once each 11 hours
Agility in Microservices
• Amazon is a heavy user of microservices
• A single shop product use case can interact with 100+ microservices
• Amazon deploy to production…
• Once each 11 hours minutes
Agility in Microservices
• Amazon is a heavy user of microservices
• A single shop product use case can interact with 100+ microservices
• Amazon deploy to production…
• Once each 11 hours minutes seconds
Agility in Microservices
• NEVER try to use microservices if the organization do not have an
strong Devops culture
• NEVER try to use microservices if a CI/CD pipeline is not established
• Doing Microservices is harder then doing Monoliths. Only
organizations that do monoliths well have a chance to do
microservices well.
So…
• Use Microservices if really need them
• Don’t use them only because Amazon and Netflix do (probably your
problems and Amazon problems are not the same).
• Remember: There are not silver bullets
Finally:
Serverless
• Serverless means that you don’t
need to bother about server
management
• A step forward than PaaS
• Services are exposed as functions
(FaaS) which are very-micro
services!
• Scale per invocation, not per server
• More on this GAPAND at 11:30 by
@adiazcan & @shmancebo ;-)
Thanks!!! 
Eduard Tomàs – Dev @ Plain concepts
@eiximenis
http://geeks.ms/etomas
#Gapand2017

Weitere ähnliche Inhalte

Was ist angesagt?

Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
DataArt
 

Was ist angesagt? (20)

ASP.NET vNext
ASP.NET vNextASP.NET vNext
ASP.NET vNext
 
MVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelMVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming model
 
Migrating to aws
Migrating to awsMigrating to aws
Migrating to aws
 
Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015
 
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
 
Agile sites2
Agile sites2Agile sites2
Agile sites2
 
Adobe AEM for Business Heads
Adobe AEM for Business HeadsAdobe AEM for Business Heads
Adobe AEM for Business Heads
 
Owin & katana
Owin & katanaOwin & katana
Owin & katana
 
Jasmine - A BDD test framework for JavaScript
Jasmine - A BDD test framework for JavaScriptJasmine - A BDD test framework for JavaScript
Jasmine - A BDD test framework for JavaScript
 
Agile sites @ telmore
Agile sites @ telmore Agile sites @ telmore
Agile sites @ telmore
 
Agile sites311training
Agile sites311trainingAgile sites311training
Agile sites311training
 
Spring cloud for microservices architecture
Spring cloud for microservices architectureSpring cloud for microservices architecture
Spring cloud for microservices architecture
 
The Dark Side of Single Page Applications
The Dark Side of Single Page ApplicationsThe Dark Side of Single Page Applications
The Dark Side of Single Page Applications
 
Extending WordPress as a pro
Extending WordPress as a proExtending WordPress as a pro
Extending WordPress as a pro
 
TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
 
Powershell For Developers
Powershell For DevelopersPowershell For Developers
Powershell For Developers
 
Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2
 
Mvc 4.0
Mvc 4.0Mvc 4.0
Mvc 4.0
 
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
 

Ähnlich wie Microservices: Yes or not?

Ähnlich wie Microservices: Yes or not? (20)

12 Factor App Methodology
12 Factor App Methodology12 Factor App Methodology
12 Factor App Methodology
 
Technology insights: Decision Science Platform
Technology insights: Decision Science PlatformTechnology insights: Decision Science Platform
Technology insights: Decision Science Platform
 
Should i break it?
Should i break it?Should i break it?
Should i break it?
 
QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes
 
Microservices: The Best Practices
Microservices: The Best PracticesMicroservices: The Best Practices
Microservices: The Best Practices
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Devoxx PL 2018 - Microservices in action at the Dutch National Police
Devoxx PL 2018 - Microservices in action at the Dutch National PoliceDevoxx PL 2018 - Microservices in action at the Dutch National Police
Devoxx PL 2018 - Microservices in action at the Dutch National Police
 
Understanding Microservices
Understanding Microservices Understanding Microservices
Understanding Microservices
 
Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...
Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...
Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...
 
Containers, microservices and serverless for realists
Containers, microservices and serverless for realistsContainers, microservices and serverless for realists
Containers, microservices and serverless for realists
 
iSense Java Summit 2017 - Microservices in action at the Dutch National Police
iSense Java Summit 2017 - Microservices in action at the Dutch National PoliceiSense Java Summit 2017 - Microservices in action at the Dutch National Police
iSense Java Summit 2017 - Microservices in action at the Dutch National Police
 
Developing Enterprise Applications for the Cloud, from Monolith to Microservices
Developing Enterprise Applications for the Cloud,from Monolith to MicroservicesDeveloping Enterprise Applications for the Cloud,from Monolith to Microservices
Developing Enterprise Applications for the Cloud, from Monolith to Microservices
 
Developing Enterprise Applications for the Cloud, from Monolith to Microservice
Developing Enterprise Applications for the Cloud, from Monolith to MicroserviceDeveloping Enterprise Applications for the Cloud, from Monolith to Microservice
Developing Enterprise Applications for the Cloud, from Monolith to Microservice
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice Architecture
 
Grokking microservices in 5 minutes
Grokking microservices in 5 minutesGrokking microservices in 5 minutes
Grokking microservices in 5 minutes
 
Microservices in action at the Dutch National Police
Microservices in action at the Dutch National PoliceMicroservices in action at the Dutch National Police
Microservices in action at the Dutch National Police
 
OpenValue meetup October 2017 - Microservices in action at the Dutch National...
OpenValue meetup October 2017 - Microservices in action at the Dutch National...OpenValue meetup October 2017 - Microservices in action at the Dutch National...
OpenValue meetup October 2017 - Microservices in action at the Dutch National...
 
JavaZone 2017 - Microservices in action at the Dutch National Police
JavaZone 2017 - Microservices in action at the Dutch National PoliceJavaZone 2017 - Microservices in action at the Dutch National Police
JavaZone 2017 - Microservices in action at the Dutch National Police
 
Introduction to microservices
Introduction to microservicesIntroduction to microservices
Introduction to microservices
 
Get There meetup March 2018 - Microservices in action at the Dutch National P...
Get There meetup March 2018 - Microservices in action at the Dutch National P...Get There meetup March 2018 - Microservices in action at the Dutch National P...
Get There meetup March 2018 - Microservices in action at the Dutch National P...
 

Mehr von Eduard Tomàs

Mehr von Eduard Tomàs (20)

Kubernetes: Do's, don'ts and why's
Kubernetes: Do's, don'ts and why'sKubernetes: Do's, don'ts and why's
Kubernetes: Do's, don'ts and why's
 
KCDS 2021- Escalando workloads serverless en Kubernetes con KEDA
KCDS 2021- Escalando workloads serverless en Kubernetes con KEDAKCDS 2021- Escalando workloads serverless en Kubernetes con KEDA
KCDS 2021- Escalando workloads serverless en Kubernetes con KEDA
 
Escalando workloads serverless en Kubernetes con Keda
Escalando workloads serverless en Kubernetes con KedaEscalando workloads serverless en Kubernetes con Keda
Escalando workloads serverless en Kubernetes con Keda
 
C#9 - Más C# que nunca
C#9 - Más C# que nuncaC#9 - Más C# que nunca
C#9 - Más C# que nunca
 
CollabDays 2020 Barcelona - Serverless Kubernetes with KEDA
CollabDays 2020 Barcelona - Serverless Kubernetes with KEDACollabDays 2020 Barcelona - Serverless Kubernetes with KEDA
CollabDays 2020 Barcelona - Serverless Kubernetes with KEDA
 
Keda o como convertir Kubernetess en Serverless
Keda o como convertir Kubernetess en ServerlessKeda o como convertir Kubernetess en Serverless
Keda o como convertir Kubernetess en Serverless
 
.NET Memoria y Rendimiento
.NET Memoria y Rendimiento.NET Memoria y Rendimiento
.NET Memoria y Rendimiento
 
Containers en .NET (Dot Net 2018 - Spain)
Containers en .NET (Dot Net 2018 - Spain)Containers en .NET (Dot Net 2018 - Spain)
Containers en .NET (Dot Net 2018 - Spain)
 
Esos contenedores, ¡a producción! (Commit Conf 2018)
Esos contenedores, ¡a producción! (Commit Conf 2018)Esos contenedores, ¡a producción! (Commit Conf 2018)
Esos contenedores, ¡a producción! (Commit Conf 2018)
 
Codemotion 2015 - Bienvenido de nuevo c++
Codemotion 2015 - Bienvenido de nuevo c++Codemotion 2015 - Bienvenido de nuevo c++
Codemotion 2015 - Bienvenido de nuevo c++
 
El "peor" lenguaje del mundo
El "peor" lenguaje del mundoEl "peor" lenguaje del mundo
El "peor" lenguaje del mundo
 
Containerize a netcore application with aks
 Containerize a netcore application with aks Containerize a netcore application with aks
Containerize a netcore application with aks
 
Escenarios avanzados en AKS (Global Azure Bootcamp Barcelona 2019)
Escenarios avanzados en AKS (Global Azure Bootcamp Barcelona 2019)Escenarios avanzados en AKS (Global Azure Bootcamp Barcelona 2019)
Escenarios avanzados en AKS (Global Azure Bootcamp Barcelona 2019)
 
Aplicaciones de consola fáciles? Más quisieramos
Aplicaciones de consola fáciles? Más quisieramosAplicaciones de consola fáciles? Más quisieramos
Aplicaciones de consola fáciles? Más quisieramos
 
Serverless with Azure Functions and CosmosDb
Serverless with Azure Functions and CosmosDbServerless with Azure Functions and CosmosDb
Serverless with Azure Functions and CosmosDb
 
Docker y todo eso... más o menos
Docker y todo eso... más o menosDocker y todo eso... más o menos
Docker y todo eso... más o menos
 
ASP.NET MVC Core
ASP.NET MVC CoreASP.NET MVC Core
ASP.NET MVC Core
 
Azure functions
Azure functionsAzure functions
Azure functions
 
React native - Unleash the power of your device
React native - Unleash the power of your deviceReact native - Unleash the power of your device
React native - Unleash the power of your device
 
JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)
 

Kürzlich hochgeladen

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 

Microservices: Yes or not?

  • 1. Microservices… Yes or not? Eduard Tomàs – Dev @ Plain concepts @eiximenis http://geeks.ms/etomas #Gapand2017
  • 4. N-tier apps • Distributed aplications • Implicit boundaries • RPC-like Common Object Request Broker Architecture DCOM & DNA Architecture RMI …
  • 5. SOA • Services have explicit boundaries • Services are autonomous • Services share schema and contract, not classes • Services interoperate based on policy “Four SoA Tenets” by Don Box • OASIS Web Services • WS-* • SOAP • Enterprise Service Bus (ESB) • WebSphere ESB • BizTalk • Oracle ESB • …
  • 6. Don Box @ Teched 2001 (BCN)
  • 7.
  • 8. Microservices The term "Microservice Architecture" has sprung up over the last few years to describe a particular way of designing software applications as suites of independently deployable services. While there is no precise definition of this architectural style, there are certain common characteristics around organization around business capability, automated deployment, intelligence in the endpoints, and decentralized control of languages and data. https://martinfowler.com/articles/microservices.html Microservices - also known as the microservice architecture - is an architectural style that structures an application as a collection of loosely coupled services, which implement business capabilities. The microservice architecture enables the continuous delivery/deployment of large, complex applications. It also enables an organization to evolve its technology stack.
  • 9. SOA vs Microservices SOA Microservicios Services are generally big Services are generally small ESB centric role Usually no need for ESB Favours orchestration over coreography Favours coreography over orquestration Share as much as possible Share as Little as posible OASIS WS-*, SOAP, XML, HTTP, … REST, HTTP, … Who cares about SOA now? Everybody talks about Microservices! Just one comparison… But, the reality is…
  • 11. Microservices are a way to do SOA
  • 12. SOAP vs REST • Heavy message format: XML and <soap:Envelope> schema • RPC based: service -> method (i.e. doctorSvc->GetAllPatients) • Uses HTTP merely as transport protocol. Can use other transports. • Small messages. No format assumed • Resource based (i.e. /doctors/<id>/patients • Embraces HTTP semantics: use HTTP verbs and return codes
  • 13. Orchestration • Main logic business belongs to a single central service (the orchestrator) • Central service calls other services and combines its results • Typical example: BPEL process
  • 14. Coreography • Logic distributed. • No central point that coordinates other services • Best with event source model
  • 15. The 8 key aspects of Microservices (by Fowler) 1. Componentization via Services 2. Organized around Business Capabilities 3. Products not Projects 4. Smart endpoints and dumb pipes 5. Decentralized Governance 6. Decentralized Data Management 7. Infrastructure Automation 8. Design for failure https://martinfowler.com/articles/microservices.html
  • 16. The 7 sins of Microservices • LUST: Using the latest & greatest tech • GLUTTONY: Excessive communication protocols • GREED: All your Service are belong to us • SLOTH: Creating a distributed monolith • WRATH: Blowing up when bad things happen • ENVY: The shared single domain fallacy • PRIDE: Testing in the world of transcience https://opencredo.com/the-seven-deadly-sins-of-microservices-redux/
  • 17. LUST • Do not believe that using the latest tech will solve all your problems • Docker, k8s, Terraform, Swarm are great technologies • But sometimes the right choice is to pick some old and boring techs
  • 18. GLUTTONY • HTTP, Protobuff, AMQP, 0MQ, gRPC, MQTT, … • All are great communication protocols… • …But not all together! • Choose one synchronous protocol… • … And an asynchronous one
  • 19. GREED • Organization needs to adapt a “microservices culture” • Each microservice belongs to specific team • Deployment, technologies & tools, processes… are team responsabilities
  • 20. SLOTH • If you don’t change your mind and develop each microservice with using same patterns and decisions used to create monoliths • You’ll finish not having microservices at all. Instead... • You’ll have a set of microservices that can’t be deployed and updated independently
  • 21. WRATH • Failure happens all of time • Must embrace DevOps mentality of shared understanding and responsibility • Rapid provisioning, monitoring and deployment are mandatory pre- requisites
  • 22. ENVY • Using a Shared Single Domain is OK when developing a monolith • In microservices is better to follow the DDD concept of ‘bounded context’ to encapsulate better our services • Anyway: there is no rule. Don’t assume that one bounded context == one microservice
  • 23. PRIDE • Testing microservices is often harder (or much harder) than testing a monolith • Test as much as you can in your CI/CD pipelines • Unit tests, integration tests, component tests, end-to-end tests. Automate them all.
  • 25. I - Codebase • One codebase, many deploys • If there is more than one codebase, it is not an app, it is a distributed system
  • 26. II - Dependencies • Explicity declare and isolate dependencies • 12 factor app never relies on the existence of “system-wide” packages • All dependencies are declared by the app… • … and a dependency isolation tool is required also
  • 27. III - Config • Store config in the environment • Configuration vary between deploys. So can’t be part of the app • Try to avoid config files, and never store them to repo • Store configuration in environment variables
  • 28. IV – Backing services • A backing Service is any external Service consumed by the app (database, rabbitmq, external mail service,…) • App must make not distinction between local and 3rd party backing services • All backing services are just attached resources that can be accessed through an URI • Any backing Service can be changed from local to 3rd party at any time, only changing configuration
  • 29. V – Build, Release, Run • Strictly separate the build & run stages • A codebase is transformed to a deploy through 3 stages • Build stage: Creating an executable from source code • Release stage: Deploying the executable to specific environment and apply config • Run stage: Starts the app by starting specific executables on the environment • These 3 stages must be completely isolaged (i. e. can’t change the code during run or release stages)
  • 30. VI - Processes • Execute the app as one or more stateless processes • Any app is stateless and share nothing. Any state must be stored in a stateful backing Service • Using local storage and/or memory is OK, only if it used as a cache in a single request lifetime • Sticky sessions are (of course) a violation of 12 factor apps
  • 31. VII – Port binding • Expose Services via port binding • A 12 factor app is completely self-contained • No runtime injection of any webserver or similar is allowed • App expose its functionality using a configurable port
  • 32. VIII - Concurrency • Scale out via process model • In 12 factor apps process is a 1st class citizen • Scale using more processes, instead of any other way (like threads) • As 12 factor apps are stateless and share nothing, concurrency and scale using processes is a safe and simple operation
  • 33. IX - Disposability • Maximize robustness with fast startup and graceful shutdown • 12 factor apps are disposable: can be stopped at any momento • App must shutdown gracefully at SIGTERM • App should be robust when a sudden death happen (i. e. hardware failure)
  • 34. X – Dev / prod parity • Keep development, staging, and production as similar as possible • App must be designed for Continuous deployment in mind: gap between prod and dev must be as small as posible • Code authors are code deployers. No “deployment team”
  • 35. XI - Logs • Treat logs as event streams • A twelve-factor app never concerns itself with routing or storage of its output stream • App never manages its logfiles: just log to the stream • Environment maps the stream wherever appropiate
  • 36. XII – Admin processes • Run admin/management tasks as one-off processes • One-off admin processes should be run in an identical environment as the regular long-running processes of the app. • Admin code must ship with application code to avoid synchronization issues.
  • 38.
  • 39. Microservices are not a free lunch! • Significant Operations Overhead • Substantial DevOps Skills Required • Implicit interfaces management • Duplication Of Effort • Distributed System Complexity • Asynchronicity Is Difficult! • Testability Challenges
  • 40. So… when to use them? • If your organization has a strong devops culture • Microservices allow to break a very big monolith in small pieces. Each piece can be managed by one pizza team. • Microservices biggest advantage is agility: you can update, test and deploy each microservice in an independent way.
  • 41. Agility in Microservices • Amazon is a heavy user of microservices • A single shop product use case can interact with 100+ microservices • Amazon deploy to production… • Once each 11 hours
  • 42. Agility in Microservices • Amazon is a heavy user of microservices • A single shop product use case can interact with 100+ microservices • Amazon deploy to production… • Once each 11 hours minutes
  • 43. Agility in Microservices • Amazon is a heavy user of microservices • A single shop product use case can interact with 100+ microservices • Amazon deploy to production… • Once each 11 hours minutes seconds
  • 44. Agility in Microservices • NEVER try to use microservices if the organization do not have an strong Devops culture • NEVER try to use microservices if a CI/CD pipeline is not established • Doing Microservices is harder then doing Monoliths. Only organizations that do monoliths well have a chance to do microservices well.
  • 45. So… • Use Microservices if really need them • Don’t use them only because Amazon and Netflix do (probably your problems and Amazon problems are not the same). • Remember: There are not silver bullets
  • 46. Finally: Serverless • Serverless means that you don’t need to bother about server management • A step forward than PaaS • Services are exposed as functions (FaaS) which are very-micro services! • Scale per invocation, not per server • More on this GAPAND at 11:30 by @adiazcan & @shmancebo ;-)
  • 47. Thanks!!!  Eduard Tomàs – Dev @ Plain concepts @eiximenis http://geeks.ms/etomas #Gapand2017