Intro to Microservices
What is a Microservice?
30 seconds about me
• DigitalOcean.
• Thomson Reuters.
• Go Developer 5 years
• Spoken all over the world
• DevOps Startup
• Rode an elephant at my wedding
Microservices are an
organizational scaling tool
Monoliths are great
RPC
Message Driven
Microservices Python bangkok
G/RPC
Protobuf definition
package helloworld;
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings
message HelloReply {
string message = 1;
}
Forget about config files
Environment variables
from envparse import env
env.read_envfile()
print('ACCESS =', env.str('AWS_ACCESS_KEY'))
print('SECRET =', env.str('AWS_SECRET_KEY'))
print('CONSULTING_LEVEL =', env.str('CONSULTING_LEVEL'))
print('OTHER =', env.str('OTHER', default='foo'))
Metrics
Metrics
from prometheus_client import Gauge
g = Gauge('my_inprogress_requests', 'Description of gauge')
g.inc() # Increment by 1
g.dec(10) # Decrement by given value
g.set(4.2) # Set to a given value
from prometheus_client import Histogram
h = Histogram('request_latency_seconds', 'Description of histogram')
h.observe(4.7) # Observe 4.7 (seconds in this case)
from prometheus_client import Counter
c = Counter('my_requests_total', 'HTTP Failures', ['method', 'endpoint'])
c.labels(method='get', endpoint='/').inc()
c.labels(method='post', endpoint='/submit').inc()
Microservices Python bangkok
Logging to files is obsolete
REK Stack
• Rsyslog
• Elastic Search
• Kibana
Structured logging
{
"program": "microservice1", "host": "box01",
"log_level": "info", "msg": "Api Request recieved",
"user_id": "12345", "rpc_method": "post_add_tick"
}
Logging
from structlog import get_logger
log = get_logger()
log.info("key_value_logging", out_of_the_box=True, effort=0)
log = log.bind(user="anonymous", some_key=23)
log = log.bind(user="hynek", another_key=42)
log.info("user.logged_in", happy=True)
Microservices Python bangkok
Container based deploys
Docker file example
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD [ "python", "./your-daemon-or-script.py" ]
Docker build
docker build -t myapp:version .
Docker Run
docker run -V /dev/log:/dev/log -E=addr=:8080 myapp:version
Breakdown
• Syslog -> -V /dev/log:/devlog
• ENV Vars -> -E addr=:8080
• Application container -> myapp:version
Ansible + Docker
Kubernetes
Cloud
• Aws Container engine
• Google Container Engine (GKE)
• Private install of Kubernetes
Why containers are the future
Questions?

More Related Content

PDF
Intro to microservices GopherDay Taipei '17
PDF
Redis
PDF
Searched gems which supports only ruby 2.6
PDF
High Performance Python Microservice Communication
PDF
ORM over REST in NodeJS
PPTX
Highload осень 2012 лекция 1
PPTX
How to configure multiple PostgreSQL-9
PDF
Dicas e truques de otimização de websites python
Intro to microservices GopherDay Taipei '17
Redis
Searched gems which supports only ruby 2.6
High Performance Python Microservice Communication
ORM over REST in NodeJS
Highload осень 2012 лекция 1
How to configure multiple PostgreSQL-9
Dicas e truques de otimização de websites python

What's hot (11)

DOCX
Assignment Server, Client Application
PDF
OpenStack - heat on boarding
ODP
Http
DOCX
Puerto serialarduino
PDF
Heat project onboarding
PPTX
Mycroft
PDF
Advanced open ssh
KEY
Socket.io
PDF
tdc2012
PDF
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
PDF
Actor Based Asyncronous IO in Akka
Assignment Server, Client Application
OpenStack - heat on boarding
Http
Puerto serialarduino
Heat project onboarding
Mycroft
Advanced open ssh
Socket.io
tdc2012
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
Actor Based Asyncronous IO in Akka
Ad

Similar to Microservices Python bangkok (20)

PDF
Andrea Di Persio
PPTX
Microservices: Breaking Apart the Monolith
PDF
Everything you want to know about microservices
PPTX
Microservices in the Enterprise
PDF
The route towards cloud automation
PPTX
Microservices-101
ODP
Monolithic to Microservices Architecture - STM 6
PDF
Airbnb, From Monolith to Microservices: How to Scale Your Architecture, Futur...
ODP
msnos: a cool and cozy blanket for your microservices - Bruno Bossola - Codem...
PPTX
Adopting Microservices - Around25
PPTX
DevOps-training-in-chandigarh-Join-now--
PDF
Design patterns for microservice architecture
PDF
Microservices in Practice
PPTX
Webinar : Microservices and Containerization
PPTX
Microservices easywaywrongway
PDF
Microservices' draw back
PPTX
Microservices architecture overview v2
ODP
Microservices - the lean way
PDF
Introduction to microservices (from rails monolith)
PDF
Do you think you're doing microservice architecture? What about infrastructur...
Andrea Di Persio
Microservices: Breaking Apart the Monolith
Everything you want to know about microservices
Microservices in the Enterprise
The route towards cloud automation
Microservices-101
Monolithic to Microservices Architecture - STM 6
Airbnb, From Monolith to Microservices: How to Scale Your Architecture, Futur...
msnos: a cool and cozy blanket for your microservices - Bruno Bossola - Codem...
Adopting Microservices - Around25
DevOps-training-in-chandigarh-Join-now--
Design patterns for microservice architecture
Microservices in Practice
Webinar : Microservices and Containerization
Microservices easywaywrongway
Microservices' draw back
Microservices architecture overview v2
Microservices - the lean way
Introduction to microservices (from rails monolith)
Do you think you're doing microservice architecture? What about infrastructur...
Ad

More from Matthew Campbell (9)

PDF
Practical Plasma: Gaming. Upbit Developers conference 2018
PDF
Distributed Timeseries Database In Go (gophercon India 17)
PDF
Distributed scheduler hell (MicroXChg 2017 Berlin)
PDF
DigitalOcean Microservices Talk Rocket Internet Conf '16
PDF
Breaking Prometheus (Promcon Berlin '16)
PDF
Cloud in your Cloud
PDF
presentation-chaos-monkey
PDF
Making Wallstreet talk with GO (GO India Conference 2015)
PDF
Intro to GO (Bangkok Launchpad 2014)
Practical Plasma: Gaming. Upbit Developers conference 2018
Distributed Timeseries Database In Go (gophercon India 17)
Distributed scheduler hell (MicroXChg 2017 Berlin)
DigitalOcean Microservices Talk Rocket Internet Conf '16
Breaking Prometheus (Promcon Berlin '16)
Cloud in your Cloud
presentation-chaos-monkey
Making Wallstreet talk with GO (GO India Conference 2015)
Intro to GO (Bangkok Launchpad 2014)

Recently uploaded (20)

PDF
Autodesk AutoCAD Crack Free Download 2025
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PDF
MCP Security Tutorial - Beginner to Advanced
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
Microsoft Office 365 Crack Download Free
PDF
Guide to Food Delivery App Development.pdf
PPTX
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
PDF
BoxLang Dynamic AWS Lambda - Japan Edition
PPTX
Download Adobe Photoshop Crack 2025 Free
PPTX
Introduction to Windows Operating System
PPTX
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
PPTX
GSA Content Generator Crack (2025 Latest)
PDF
Practical Indispensable Project Management Tips for Delivering Successful Exp...
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PPTX
Computer Software - Technology and Livelihood Education
PPTX
Tech Workshop Escape Room Tech Workshop
PDF
E-Commerce Website Development Companyin india
Autodesk AutoCAD Crack Free Download 2025
How to Use SharePoint as an ISO-Compliant Document Management System
Wondershare Recoverit Full Crack New Version (Latest 2025)
MCP Security Tutorial - Beginner to Advanced
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
CNN LeNet5 Architecture: Neural Networks
Microsoft Office 365 Crack Download Free
Guide to Food Delivery App Development.pdf
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
BoxLang Dynamic AWS Lambda - Japan Edition
Download Adobe Photoshop Crack 2025 Free
Introduction to Windows Operating System
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
GSA Content Generator Crack (2025 Latest)
Practical Indispensable Project Management Tips for Delivering Successful Exp...
DNT Brochure 2025 – ISV Solutions @ D365
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Computer Software - Technology and Livelihood Education
Tech Workshop Escape Room Tech Workshop
E-Commerce Website Development Companyin india

Microservices Python bangkok