SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
Micro Services
Intro & implementation of a microservices
architecture
Docker Athens Spyros Lambrinidis @slambrinidis CTO
18 Feb 2014 Panagiotis Moustafellos @pmoust DevOps
What is a MicroService
“approach to developing a single application as
a suite of small services”
“designing software applications as suites of
independently deployable services”
What is a MicroService
What is a MicroService
● Each service is loosely coupled /
independently deployable
○ Changes made only to this service
● Each service has a bounded context
○ Service should not know about surrounding service
(domain driven design)
Characteristics
● Services
● Products vs Projects
● Smart endpoints / dumb pipes
● Decentralized governance
● Decentralised data management
● Automation
● Design for failure
● Evolutionary design
Simple Blog Example
ELB
WebServer / FE
WebServer / FE
Comments
Service
Pages
Service
Posts
Service
Redis
MySql
MySql
Mongo
Redis
SOLR
Advantages
● Small code base / easier to test / maintain
● Easy to scale - clone
● Easy to throw away
● Easy to deploy and track errors
● Freedom to switch tech stack
● Maximise team agility
● Maximise resource utilisation
Disadvantages
● Devops challenge on multiple fronts
● Complexity in messaging and front end
● Most container technologies still new
● Freedom of tech stack not always good
news (for the future and for the CTO)
Micro Service and agility
● Modern agile practice can not ignore tech
● No modern tech = no absolute agility
● Micro services enable agility in a special way
○ Enforce team creation
○ Enforce faster deployments / better & easier tests
○ CI / CD
○ Easier communication flow methods (APIs)
○ Each service = small scale product
Container Technology in micros
● Containers assist micro architecture in
○ Visualising services
○ Building / sharing services between coders
○ Deploying services
○ Utilising server resources to run containers
irrespective of underlying tech
● Popular container technologies
○ Docker
○ Rocket
Container Management
● Used to maintain and utilize containers /
services
○ Make sure all services up and running
○ Make sure server utilisation is maxed out
● Popular container management technologies
○ CoreOS fleet
○ Docker-machine
○ Mesos
○ Kubernetes
○ AWS ECS / Google Container Engine
PPH Specifics
● Architecture history
○ 2008 shared server – outsourced code – raw php
○ 2010 more servers on peer1 and standalone mysql
○ 2010 move to aws
○ 2011 move to yii framework (not 100% complete)
○ Multiple features and optimisation since then
○ 2014 – supertasker.com launch
● Present
○ Monolithic app
○ Multiple db tech (sql, dynamo, mongo, memcache)
○ Search through SOLR
○ Traffic on supertasker.com
PPH Challenges
● Constantly Growing load (data + traffic)
○ 160GB db
○ 1300 rpm avg
○ 35k uniques / day (55k sessions)
● Code complexity from multiple features
● Usage of yii v1.6 – difficult to change. Not exciting for
devs to work on it
● Code tightly coupled in many ways
● More products evolving and needing similar features –
supertasker.com
PPH Future
● Minimise core db - micros use their own
● Ability to scale to amazing level - scale out
○ design to clone things (clone dbs / web servers)
○ design to split things (one core vs many small ones)
○ design to split similar things (shard / partition)
● Absolute resource utilisation
● Devs playground (use desired tech – within limits)
PPH Future
● Utilisation of communities through container sharing –
no need to share apps
● Service sharing between products
● Fully tested / API enabled services
● Gradually decrease power or core db and machines
○ never reach maximum of scaliong up ability
PPH Micro Internals
● Container technology
○ Docker
○ Docker-compose
● Preferred micro language
○ Php using yii v2 which is REST API enabled
● REST API
○ Communication only through well defined APIs
● Full tested Services
○ Each service to have full test coverage (unit & integration & contract)
PPH Micro Internals
● Data
○ Each service to be tied to its own data
● Container Management
○ CoreOS fleet
● Deployment
● CI tool
○ shippable
Workflow: PPH Metrics
● planning the ecosystem
● keeping it simple
● describing the infrastructure plan under version control
● describing the API
● opting for identical D-S-P environments
● enforcing testing (make everything fail)
● deploying seamlessly (as possible)
● applying Continuous Integration & Continuous Delivery
PPH Metrics: Planning
Goals:
● Scalable
● Self-contained
● Interoperable
● Proven in production
● Cost effective
PPH preference:
AWS EC2 AutoScaling + CoreOS (stable channel)
PPH Metrics: defining an API
● Lots of tools (Swagger, RAML, etc)
● Well defined entities - check out schema.org
● Discussion amongst dev team for internal API usage
● Join Athens API Meetup :)
We were lazy - no excuses - moving on
PPH Metrics: KISS
● Single node definition
● Single scaling up/down strategy
● Platform agnostic (if possible)
● Human readable Configuration Management and IaC
● DevOps friendly (bridge the gap between Dev & Ops)
● API matters - Preferred Stack does not (or does it?)
● Bring up dev environment in seconds
PPH Metrics: Describing it whole
● Infrastructure as Code
Terraform
● Configuration Management
CoreOS Cloud-config + Fleet Services
● Linking Containers
docker-compose / swarm
PPH Metrics: Terraform
Why Terraform?
● Ops make mistakes
● Many environments, many resources, too much room for error, too little time for documenting changes and
current state
● Awesome human readable DSL
● Easy to maintain infrastructure state
● Multiple providers (we just needed AWS)
● Developers understand it
● Still very fresh, but well tested
● Created by Hashicorp
Version 0.3.7 meets our needs
We made small contributions that we needed to have upstream
Terraform DSL - defining an AWS autoscaling group behind a Load Balancer
PPH Metrics: CoreOS
Why CoreOS?
● Built with application containers in mind
● Built for scale
● Fleet - manages nodes and services in a cluster
● Etcd - distributed key-value store
● [Unit] - [Service] - [Timer]
● fleetctl - the cli tool to manage Fleet
● etcdctl - the cli tool to manage Etcd
Hands-on example: Cloud-config
#cloud-config
coreos:
etcd:
discovery: https://discovery.etcd.io/<YOUR_TOKEN>
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
fleet:
public-ip: $private_ipv4
metadata: role=microservices
update:
group: stable
reboot-strategy: etcd-lock
users:
- name: pmoust
coreos-ssh-import-github: pmoust
groups:
- sudo
- docker
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1
.
manage_etc_hosts: localhost
units:
- name: etcd.service
runtime: true
command: start
- name: fleet.service
runtime: true
command: start
- name: metrics.service
command: start
content: |
[Unit]
Description=Metrics
Author=pmoust
After=docker.service
[Service]
Restart=always
ExecStartPre=/usr/bin/docker kill metrics
ExecStartPre=/usr/bin/docker rm metrics
ExecStartPre=/usr/bin/docker pull peopleperhour/metrics
ExecStart=/usr/bin/docker run --rm --name metrics peopleperhour/metrics
ExecStop=/usr/bin/docker stop -t 5 metrics
PPH Metrics: Fleet + services
~ export FLEETCTL_ENDPOINT=http://10.30.2.234:4001
~ fleetctl list-machines
MACHINE IP METADATA
66cc918ae936440b896d201ee47b3877 10.30.2.234 role=microservices
bf78eab69d3f4c6f9310c971fd95fd4d 10.30.1.68 role=microservices
~ fleetctl start metrics.service
~ fleetctl list-units -l
UNIT MACHINE ACTIVE SUB
metrics.service 66cc918ae936440b896d201ee47b3877/10.30.2.234 active running
metrics.service bf78eab69d3f4c6f9310c971fd95fd4d/10.30.1.68 active running
PPH Metrics: etcd
Used for service discovery and generating configuration files (via confd or other methods)
~ etcdctl ls --recursive /
/microservices
/microservices/metrics/10.30.2.234:6000
/microservices/metrics/10.30.1.68:6000
/microservices/metrics/version/ffa2eeb4
/microservices/metrics/db/host/metrics.db.peopleperhour.com
/microservices/metrics/db/name/metrics
/microservices/metrics/db/user/awsdbuser
/microservices/metrics/db/pass/youwish
/microservices/metrics/aws/access_key/KEY
/microservices/metrics/aws/secret_key/SECRET_KEY
/microservices/metrics/google/adwords/clientId/CLIENT_ID

...
PPH Metrics: Keeping envs identical
The Stack
● MySQL
● Nginx
● PHP (in FastCGI)
● Memcached
● Metrics (our Yii2 framework app (with its dependencies))
In Staging and Production environments most of the stack is out of container scope
MySQL -> AWS RDS HTTP LoadBalancing -> AWS ELB Memcached - AWS ElasticCache
Etcd holds their endpoints and connection credentials
How do we link all these in a Development environment (and remain sane)?
PPH Metrics: docker-compose
Fast, isolated development environments using Docker.
Simple YAML syntax to link containers, container volumes, expose ports & link hosts.
● Deployment (strive for seamless updates)
● Continuous Integration
● Continuous Delivery
TBD in an upcoming Docker Athens Meetup
PPH Metrics: Ship it!
Thank you!
Questions?

Weitere Àhnliche Inhalte

Was ist angesagt?

Delivering Developer Tools at Scale
Delivering Developer Tools at ScaleDelivering Developer Tools at Scale
Delivering Developer Tools at ScaleOracle Developers
 
56k.cloud training
56k.cloud training56k.cloud training
56k.cloud trainingBrian Christner
 
Containers and Kubernetes
Containers and KubernetesContainers and Kubernetes
Containers and KubernetesAltoros
 
Oracle Code Keynote with Thomas Kurian
Oracle Code Keynote with Thomas KurianOracle Code Keynote with Thomas Kurian
Oracle Code Keynote with Thomas KurianOracle Developers
 
Improving Your Company’s Health with Middleware Takeout
Improving Your Company’s Health with Middleware TakeoutImproving Your Company’s Health with Middleware Takeout
Improving Your Company’s Health with Middleware TakeoutVMware Tanzu
 
Innovation with Open Sources and App Modernization for Developers | Ian Y. Choi
Innovation with Open Sources and App Modernization for Developers | Ian Y. ChoiInnovation with Open Sources and App Modernization for Developers | Ian Y. Choi
Innovation with Open Sources and App Modernization for Developers | Ian Y. ChoiVietnam Open Infrastructure User Group
 
Building a PaaS Platform like Bluemix on OpenStack
Building a PaaS Platform like Bluemix on OpenStackBuilding a PaaS Platform like Bluemix on OpenStack
Building a PaaS Platform like Bluemix on OpenStackAnimesh Singh
 
Evénement Docker Paris: Anticipez les nouveaux business model et réduisez vos...
Evénement Docker Paris: Anticipez les nouveaux business model et réduisez vos...Evénement Docker Paris: Anticipez les nouveaux business model et réduisez vos...
Evénement Docker Paris: Anticipez les nouveaux business model et réduisez vos...Docker, Inc.
 
Containers and VMs and Clouds: Oh My. by Mike Coleman
Containers and VMs and Clouds: Oh My. by Mike ColemanContainers and VMs and Clouds: Oh My. by Mike Coleman
Containers and VMs and Clouds: Oh My. by Mike ColemanDocker, Inc.
 
DCSF 19 Developing Apps with Containers, Functions and Cloud Services
DCSF 19 Developing Apps with Containers, Functions and Cloud ServicesDCSF 19 Developing Apps with Containers, Functions and Cloud Services
DCSF 19 Developing Apps with Containers, Functions and Cloud ServicesDocker, Inc.
 
Why kubernetes matters
Why kubernetes mattersWhy kubernetes matters
Why kubernetes mattersPlatform9
 
Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...
Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...
Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...Animesh Singh
 
Devops: Enabled Through a Recasting of Operational Roles
Devops: Enabled Through a Recasting of Operational RolesDevops: Enabled Through a Recasting of Operational Roles
Devops: Enabled Through a Recasting of Operational Rolescornelia davis
 
Cloud Foundry BOSH CPI for OpenStack
Cloud Foundry BOSH CPI for OpenStackCloud Foundry BOSH CPI for OpenStack
Cloud Foundry BOSH CPI for OpenStackAnimesh Singh
 
A Million ways of Deploying a Kubernetes Cluster
A Million ways of Deploying a Kubernetes ClusterA Million ways of Deploying a Kubernetes Cluster
A Million ways of Deploying a Kubernetes ClusterJimmy Lu
 
Alibaba Cloud Conference 2016 - Docker Enterprise
Alibaba Cloud Conference   2016 - Docker EnterpriseAlibaba Cloud Conference   2016 - Docker Enterprise
Alibaba Cloud Conference 2016 - Docker EnterpriseJohn Willis
 
Containers, microservices and serverless for realists
Containers, microservices and serverless for realistsContainers, microservices and serverless for realists
Containers, microservices and serverless for realistsKarthik Gaekwad
 
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...Docker, Inc.
 
Cloud-native Application Lifecycle Management
Cloud-native Application Lifecycle ManagementCloud-native Application Lifecycle Management
Cloud-native Application Lifecycle ManagementNeil Gehani
 
How to Make Money Solving 5 Major Problems of Cloud Hosting Customers
How to Make Money Solving 5 Major Problems of Cloud Hosting CustomersHow to Make Money Solving 5 Major Problems of Cloud Hosting Customers
How to Make Money Solving 5 Major Problems of Cloud Hosting CustomersJelastic Multi-Cloud PaaS
 

Was ist angesagt? (20)

Delivering Developer Tools at Scale
Delivering Developer Tools at ScaleDelivering Developer Tools at Scale
Delivering Developer Tools at Scale
 
56k.cloud training
56k.cloud training56k.cloud training
56k.cloud training
 
Containers and Kubernetes
Containers and KubernetesContainers and Kubernetes
Containers and Kubernetes
 
Oracle Code Keynote with Thomas Kurian
Oracle Code Keynote with Thomas KurianOracle Code Keynote with Thomas Kurian
Oracle Code Keynote with Thomas Kurian
 
Improving Your Company’s Health with Middleware Takeout
Improving Your Company’s Health with Middleware TakeoutImproving Your Company’s Health with Middleware Takeout
Improving Your Company’s Health with Middleware Takeout
 
Innovation with Open Sources and App Modernization for Developers | Ian Y. Choi
Innovation with Open Sources and App Modernization for Developers | Ian Y. ChoiInnovation with Open Sources and App Modernization for Developers | Ian Y. Choi
Innovation with Open Sources and App Modernization for Developers | Ian Y. Choi
 
Building a PaaS Platform like Bluemix on OpenStack
Building a PaaS Platform like Bluemix on OpenStackBuilding a PaaS Platform like Bluemix on OpenStack
Building a PaaS Platform like Bluemix on OpenStack
 
Evénement Docker Paris: Anticipez les nouveaux business model et réduisez vos...
Evénement Docker Paris: Anticipez les nouveaux business model et réduisez vos...Evénement Docker Paris: Anticipez les nouveaux business model et réduisez vos...
Evénement Docker Paris: Anticipez les nouveaux business model et réduisez vos...
 
Containers and VMs and Clouds: Oh My. by Mike Coleman
Containers and VMs and Clouds: Oh My. by Mike ColemanContainers and VMs and Clouds: Oh My. by Mike Coleman
Containers and VMs and Clouds: Oh My. by Mike Coleman
 
DCSF 19 Developing Apps with Containers, Functions and Cloud Services
DCSF 19 Developing Apps with Containers, Functions and Cloud ServicesDCSF 19 Developing Apps with Containers, Functions and Cloud Services
DCSF 19 Developing Apps with Containers, Functions and Cloud Services
 
Why kubernetes matters
Why kubernetes mattersWhy kubernetes matters
Why kubernetes matters
 
Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...
Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...
Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...
 
Devops: Enabled Through a Recasting of Operational Roles
Devops: Enabled Through a Recasting of Operational RolesDevops: Enabled Through a Recasting of Operational Roles
Devops: Enabled Through a Recasting of Operational Roles
 
Cloud Foundry BOSH CPI for OpenStack
Cloud Foundry BOSH CPI for OpenStackCloud Foundry BOSH CPI for OpenStack
Cloud Foundry BOSH CPI for OpenStack
 
A Million ways of Deploying a Kubernetes Cluster
A Million ways of Deploying a Kubernetes ClusterA Million ways of Deploying a Kubernetes Cluster
A Million ways of Deploying a Kubernetes Cluster
 
Alibaba Cloud Conference 2016 - Docker Enterprise
Alibaba Cloud Conference   2016 - Docker EnterpriseAlibaba Cloud Conference   2016 - Docker Enterprise
Alibaba Cloud Conference 2016 - Docker Enterprise
 
Containers, microservices and serverless for realists
Containers, microservices and serverless for realistsContainers, microservices and serverless for realists
Containers, microservices and serverless for realists
 
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...
 
Cloud-native Application Lifecycle Management
Cloud-native Application Lifecycle ManagementCloud-native Application Lifecycle Management
Cloud-native Application Lifecycle Management
 
How to Make Money Solving 5 Major Problems of Cloud Hosting Customers
How to Make Money Solving 5 Major Problems of Cloud Hosting CustomersHow to Make Money Solving 5 Major Problems of Cloud Hosting Customers
How to Make Money Solving 5 Major Problems of Cloud Hosting Customers
 

Ähnlich wie introduction to micro services

OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...NETWAYS
 
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a MonthUSENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a MonthNicolas Brousse
 
Public Cloud Workshop
Public Cloud WorkshopPublic Cloud Workshop
Public Cloud WorkshopAmer Ather
 
Designing for operability and managability
Designing for operability and managabilityDesigning for operability and managability
Designing for operability and managabilityGaurav Bahrani
 
NetflixOSS Meetup S6E1 - Titus & Containers
NetflixOSS Meetup S6E1 - Titus & ContainersNetflixOSS Meetup S6E1 - Titus & Containers
NetflixOSS Meetup S6E1 - Titus & Containersaspyker
 
Yotpo microservices
Yotpo microservicesYotpo microservices
Yotpo microservicesRon Barabash
 
Introduction to PaaS and Heroku
Introduction to PaaS and HerokuIntroduction to PaaS and Heroku
Introduction to PaaS and HerokuTapio Rautonen
 
Open shift and docker - october,2014
Open shift and docker - october,2014Open shift and docker - october,2014
Open shift and docker - october,2014Hojoong Kim
 
CNCF Singapore - Introduction to Envoy
CNCF Singapore - Introduction to EnvoyCNCF Singapore - Introduction to Envoy
CNCF Singapore - Introduction to EnvoyHarish
 
Modern Elastic Datacenter Architecture
Modern Elastic Datacenter ArchitectureModern Elastic Datacenter Architecture
Modern Elastic Datacenter ArchitectureWeston Bassler
 
Automating using Ansible
Automating using AnsibleAutomating using Ansible
Automating using AnsibleAlok Patra
 
DevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and ProjectsDevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and ProjectsFedir RYKHTIK
 
Truemotion Adventures in Containerization
Truemotion Adventures in ContainerizationTruemotion Adventures in Containerization
Truemotion Adventures in ContainerizationRyan Hunter
 
.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los AngelesVMware Tanzu
 
MRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
MRA AMA Part 10: Kubernetes and the Microservices Reference ArchitectureMRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
MRA AMA Part 10: Kubernetes and the Microservices Reference ArchitectureNGINX, Inc.
 
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...HBaseCon
 
Next gen software operations models in the cloud
Next gen software operations models in the cloudNext gen software operations models in the cloud
Next gen software operations models in the cloudAarno Aukia
 
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka Mario Ishara Fernando
 
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases DistributedRedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases DistributedRedis Labs
 
Promise of DevOps
Promise of DevOpsPromise of DevOps
Promise of DevOpsJuraj Hantak
 

Ähnlich wie introduction to micro services (20)

OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...
 
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a MonthUSENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
 
Public Cloud Workshop
Public Cloud WorkshopPublic Cloud Workshop
Public Cloud Workshop
 
Designing for operability and managability
Designing for operability and managabilityDesigning for operability and managability
Designing for operability and managability
 
NetflixOSS Meetup S6E1 - Titus & Containers
NetflixOSS Meetup S6E1 - Titus & ContainersNetflixOSS Meetup S6E1 - Titus & Containers
NetflixOSS Meetup S6E1 - Titus & Containers
 
Yotpo microservices
Yotpo microservicesYotpo microservices
Yotpo microservices
 
Introduction to PaaS and Heroku
Introduction to PaaS and HerokuIntroduction to PaaS and Heroku
Introduction to PaaS and Heroku
 
Open shift and docker - october,2014
Open shift and docker - october,2014Open shift and docker - october,2014
Open shift and docker - october,2014
 
CNCF Singapore - Introduction to Envoy
CNCF Singapore - Introduction to EnvoyCNCF Singapore - Introduction to Envoy
CNCF Singapore - Introduction to Envoy
 
Modern Elastic Datacenter Architecture
Modern Elastic Datacenter ArchitectureModern Elastic Datacenter Architecture
Modern Elastic Datacenter Architecture
 
Automating using Ansible
Automating using AnsibleAutomating using Ansible
Automating using Ansible
 
DevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and ProjectsDevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and Projects
 
Truemotion Adventures in Containerization
Truemotion Adventures in ContainerizationTruemotion Adventures in Containerization
Truemotion Adventures in Containerization
 
.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles
 
MRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
MRA AMA Part 10: Kubernetes and the Microservices Reference ArchitectureMRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
MRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
 
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
 
Next gen software operations models in the cloud
Next gen software operations models in the cloudNext gen software operations models in the cloud
Next gen software operations models in the cloud
 
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
 
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases DistributedRedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
 
Promise of DevOps
Promise of DevOpsPromise of DevOps
Promise of DevOps
 

KĂŒrzlich hochgeladen

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 WorkerThousandEyes
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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 AmsterdamUiPathCommunity
 
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.pptxRustici Software
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Christopher Logan Kennedy
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vĂĄzquez
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
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 2024Victor Rentea
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

KĂŒrzlich hochgeladen (20)

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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
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
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

introduction to micro services

  • 1. Micro Services Intro & implementation of a microservices architecture Docker Athens Spyros Lambrinidis @slambrinidis CTO 18 Feb 2014 Panagiotis Moustafellos @pmoust DevOps
  • 2. What is a MicroService “approach to developing a single application as a suite of small services” “designing software applications as suites of independently deployable services”
  • 3. What is a MicroService
  • 4. What is a MicroService ● Each service is loosely coupled / independently deployable ○ Changes made only to this service ● Each service has a bounded context ○ Service should not know about surrounding service (domain driven design)
  • 5. Characteristics ● Services ● Products vs Projects ● Smart endpoints / dumb pipes ● Decentralized governance ● Decentralised data management ● Automation ● Design for failure ● Evolutionary design
  • 6. Simple Blog Example ELB WebServer / FE WebServer / FE Comments Service Pages Service Posts Service Redis MySql MySql Mongo Redis SOLR
  • 7. Advantages ● Small code base / easier to test / maintain ● Easy to scale - clone ● Easy to throw away ● Easy to deploy and track errors ● Freedom to switch tech stack ● Maximise team agility ● Maximise resource utilisation
  • 8. Disadvantages ● Devops challenge on multiple fronts ● Complexity in messaging and front end ● Most container technologies still new ● Freedom of tech stack not always good news (for the future and for the CTO)
  • 9. Micro Service and agility ● Modern agile practice can not ignore tech ● No modern tech = no absolute agility ● Micro services enable agility in a special way ○ Enforce team creation ○ Enforce faster deployments / better & easier tests ○ CI / CD ○ Easier communication flow methods (APIs) ○ Each service = small scale product
  • 10. Container Technology in micros ● Containers assist micro architecture in ○ Visualising services ○ Building / sharing services between coders ○ Deploying services ○ Utilising server resources to run containers irrespective of underlying tech ● Popular container technologies ○ Docker ○ Rocket
  • 11. Container Management ● Used to maintain and utilize containers / services ○ Make sure all services up and running ○ Make sure server utilisation is maxed out ● Popular container management technologies ○ CoreOS fleet ○ Docker-machine ○ Mesos ○ Kubernetes ○ AWS ECS / Google Container Engine
  • 12. PPH Specifics ● Architecture history ○ 2008 shared server – outsourced code – raw php ○ 2010 more servers on peer1 and standalone mysql ○ 2010 move to aws ○ 2011 move to yii framework (not 100% complete) ○ Multiple features and optimisation since then ○ 2014 – supertasker.com launch ● Present ○ Monolithic app ○ Multiple db tech (sql, dynamo, mongo, memcache) ○ Search through SOLR ○ Traffic on supertasker.com
  • 13. PPH Challenges ● Constantly Growing load (data + traffic) ○ 160GB db ○ 1300 rpm avg ○ 35k uniques / day (55k sessions) ● Code complexity from multiple features ● Usage of yii v1.6 – difficult to change. Not exciting for devs to work on it ● Code tightly coupled in many ways ● More products evolving and needing similar features – supertasker.com
  • 14. PPH Future ● Minimise core db - micros use their own ● Ability to scale to amazing level - scale out ○ design to clone things (clone dbs / web servers) ○ design to split things (one core vs many small ones) ○ design to split similar things (shard / partition) ● Absolute resource utilisation ● Devs playground (use desired tech – within limits)
  • 15. PPH Future ● Utilisation of communities through container sharing – no need to share apps ● Service sharing between products ● Fully tested / API enabled services ● Gradually decrease power or core db and machines ○ never reach maximum of scaliong up ability
  • 16. PPH Micro Internals ● Container technology ○ Docker ○ Docker-compose ● Preferred micro language ○ Php using yii v2 which is REST API enabled ● REST API ○ Communication only through well defined APIs ● Full tested Services ○ Each service to have full test coverage (unit & integration & contract)
  • 17. PPH Micro Internals ● Data ○ Each service to be tied to its own data ● Container Management ○ CoreOS fleet ● Deployment ● CI tool ○ shippable
  • 18. Workflow: PPH Metrics ● planning the ecosystem ● keeping it simple ● describing the infrastructure plan under version control ● describing the API ● opting for identical D-S-P environments ● enforcing testing (make everything fail) ● deploying seamlessly (as possible) ● applying Continuous Integration & Continuous Delivery
  • 19. PPH Metrics: Planning Goals: ● Scalable ● Self-contained ● Interoperable ● Proven in production ● Cost effective PPH preference: AWS EC2 AutoScaling + CoreOS (stable channel)
  • 20. PPH Metrics: defining an API ● Lots of tools (Swagger, RAML, etc) ● Well defined entities - check out schema.org ● Discussion amongst dev team for internal API usage ● Join Athens API Meetup :) We were lazy - no excuses - moving on
  • 21. PPH Metrics: KISS ● Single node definition ● Single scaling up/down strategy ● Platform agnostic (if possible) ● Human readable Configuration Management and IaC ● DevOps friendly (bridge the gap between Dev & Ops) ● API matters - Preferred Stack does not (or does it?) ● Bring up dev environment in seconds
  • 22. PPH Metrics: Describing it whole ● Infrastructure as Code Terraform ● Configuration Management CoreOS Cloud-config + Fleet Services ● Linking Containers docker-compose / swarm
  • 23. PPH Metrics: Terraform Why Terraform? ● Ops make mistakes ● Many environments, many resources, too much room for error, too little time for documenting changes and current state ● Awesome human readable DSL ● Easy to maintain infrastructure state ● Multiple providers (we just needed AWS) ● Developers understand it ● Still very fresh, but well tested ● Created by Hashicorp Version 0.3.7 meets our needs We made small contributions that we needed to have upstream
  • 24. Terraform DSL - defining an AWS autoscaling group behind a Load Balancer
  • 25. PPH Metrics: CoreOS Why CoreOS? ● Built with application containers in mind ● Built for scale ● Fleet - manages nodes and services in a cluster ● Etcd - distributed key-value store ● [Unit] - [Service] - [Timer] ● fleetctl - the cli tool to manage Fleet ● etcdctl - the cli tool to manage Etcd
  • 26. Hands-on example: Cloud-config #cloud-config coreos: etcd: discovery: https://discovery.etcd.io/<YOUR_TOKEN> addr: $private_ipv4:4001 peer-addr: $private_ipv4:7001 fleet: public-ip: $private_ipv4 metadata: role=microservices update: group: stable reboot-strategy: etcd-lock users: - name: pmoust coreos-ssh-import-github: pmoust groups: - sudo - docker ssh_authorized_keys: - ssh-rsa AAAAB3NzaC1
. manage_etc_hosts: localhost units: - name: etcd.service runtime: true command: start - name: fleet.service runtime: true command: start - name: metrics.service command: start content: | [Unit] Description=Metrics Author=pmoust After=docker.service [Service] Restart=always ExecStartPre=/usr/bin/docker kill metrics ExecStartPre=/usr/bin/docker rm metrics ExecStartPre=/usr/bin/docker pull peopleperhour/metrics ExecStart=/usr/bin/docker run --rm --name metrics peopleperhour/metrics ExecStop=/usr/bin/docker stop -t 5 metrics
  • 27. PPH Metrics: Fleet + services ~ export FLEETCTL_ENDPOINT=http://10.30.2.234:4001 ~ fleetctl list-machines MACHINE IP METADATA 66cc918ae936440b896d201ee47b3877 10.30.2.234 role=microservices bf78eab69d3f4c6f9310c971fd95fd4d 10.30.1.68 role=microservices ~ fleetctl start metrics.service ~ fleetctl list-units -l UNIT MACHINE ACTIVE SUB metrics.service 66cc918ae936440b896d201ee47b3877/10.30.2.234 active running metrics.service bf78eab69d3f4c6f9310c971fd95fd4d/10.30.1.68 active running
  • 28. PPH Metrics: etcd Used for service discovery and generating configuration files (via confd or other methods) ~ etcdctl ls --recursive / /microservices /microservices/metrics/10.30.2.234:6000 /microservices/metrics/10.30.1.68:6000 /microservices/metrics/version/ffa2eeb4 /microservices/metrics/db/host/metrics.db.peopleperhour.com /microservices/metrics/db/name/metrics /microservices/metrics/db/user/awsdbuser /microservices/metrics/db/pass/youwish /microservices/metrics/aws/access_key/KEY /microservices/metrics/aws/secret_key/SECRET_KEY /microservices/metrics/google/adwords/clientId/CLIENT_ID 
...
  • 29. PPH Metrics: Keeping envs identical The Stack ● MySQL ● Nginx ● PHP (in FastCGI) ● Memcached ● Metrics (our Yii2 framework app (with its dependencies)) In Staging and Production environments most of the stack is out of container scope MySQL -> AWS RDS HTTP LoadBalancing -> AWS ELB Memcached - AWS ElasticCache Etcd holds their endpoints and connection credentials How do we link all these in a Development environment (and remain sane)?
  • 30. PPH Metrics: docker-compose Fast, isolated development environments using Docker. Simple YAML syntax to link containers, container volumes, expose ports & link hosts.
  • 31. ● Deployment (strive for seamless updates) ● Continuous Integration ● Continuous Delivery TBD in an upcoming Docker Athens Meetup PPH Metrics: Ship it!