Bootstrapping Microservices
What is a Microservice?
Microservices are an organizational
scaling tool
Monoliths are great
RPC
Message Driven
Intro to microservices  GopherDay Taipei '17
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;
}
Go Implementation
// server is used to implement helloworld.GreeterServer.
type server struct{}
// SayHello implements helloworld.GreeterServer
func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
return &pb.HelloReply{Message: "Hello " + in.Name}, nil
}
Forget about config files
Environment variables
import "github.com/ianschenck/envflag"
bindAddress := envflag.String(
"ADDR",
":8080",
"Bind address for the api server")
Metrics
Metrics
import "github.com/prometheus/client_golang/prometheus"
var rpcDurations = prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Name: "rpc_durations_seconds",
Help: "RPC latency distributions.",
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
},
[]string{"service"}
func whatever() {
start := time.Now()
//do something
rpcDurations.Observe(time.Since(start))
}
Intro to microservices  GopherDay Taipei '17
Logging to files is obsolete
REK Stack
4 Rsyslog
4 Elastic Search
4 Kibana
Structured logging
{
"program": "microservice1", "host": "box01",
"log_level": "info", "msg": "Api Request recieved",
"user_id": "12345", "rpc_method": "post_add_tick"
}
Logging
import log "github.com/Sirupsen/logrus"
func main() {
log.SetFormatter(&log.JSONFormatter{})
//Will log to /dev/log
hook, err := logrus_syslog.NewSyslogHook("", "", syslog.LOG_INFO, "")
if err != nil {
log.Error("Unable to connect to local syslog daemon")
} else {
log.AddHook(hook)
}
}
Intro to microservices  GopherDay Taipei '17
Integration tests
Container based deploys
Docker file example
FROM golang:latest
RUN mkdir /app
ADD . /app/
WORKDIR /app
RUN go build -o main .
CMD ["/app/main"]
Docker build
docker build -t myapp:version .
Docker Run
docker run -V /dev/log:/dev/log -E=addr=:8080 myapp:version
Breakdown
4 Syslog -> -V /dev/log:/devlog
4 ENV Vars -> -E addr=:8080
4 Application container -> myapp:version
Continous Integration
Intro to microservices  GopherDay Taipei '17
Ansible + Docker
Kubernetes
Why is Go the future of microservices?
Questions?

More Related Content

PDF
Microservices Python bangkok
PDF
Redis
PDF
Searched gems which supports only ruby 2.6
PDF
High Performance Python Microservice Communication
PDF
ORM over REST in NodeJS
PDF
Subversion To Mercurial
PPTX
Highload осень 2012 лекция 1
PPTX
How to configure multiple PostgreSQL-9
Microservices Python bangkok
Redis
Searched gems which supports only ruby 2.6
High Performance Python Microservice Communication
ORM over REST in NodeJS
Subversion To Mercurial
Highload осень 2012 лекция 1
How to configure multiple PostgreSQL-9

What's hot (16)

DOCX
Assignment Server, Client Application
PDF
Dicas e truques de otimização de websites python
PDF
OpenStack - heat on boarding
PDF
GopherFest 2017 - Adding Context to NATS
PPTX
Building real-time apps with WebSockets
PDF
Heat project onboarding
DOCX
Puerto serialarduino
PPTX
Mycroft
PDF
Actor Based Asyncronous IO in Akka
ODP
Http
KEY
Socket.io
PDF
Advanced open ssh
PDF
tdc2012
PDF
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
PDF
Yet another json rpc library (mole rpc)
PPT
Azure ServiceBus Queues and Topics
Assignment Server, Client Application
Dicas e truques de otimização de websites python
OpenStack - heat on boarding
GopherFest 2017 - Adding Context to NATS
Building real-time apps with WebSockets
Heat project onboarding
Puerto serialarduino
Mycroft
Actor Based Asyncronous IO in Akka
Http
Socket.io
Advanced open ssh
tdc2012
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
Yet another json rpc library (mole rpc)
Azure ServiceBus Queues and Topics
Ad

Similar to Intro to microservices GopherDay Taipei '17 (20)

PDF
gRPC Microservices in Go (MEAP V08) Hüseyin Babal
PDF
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
PDF
Andrea Di Persio
PPTX
Yotpo microservices
PDF
Build microservice with gRPC in golang
PDF
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
PDF
Microservices Communication Patterns with gRPC
PDF
CloudLand 2023: Rock, Paper, Scissors Cloud Competition - Go vs. Java
PDF
A microservice architecture based on golang
PDF
Go at uber
PDF
A sane approach to microservices
PDF
Monolith vs Microservices with Golang at practice - Ivan Kutuzov
PDF
What we learnt at carousell tw for golang gathering #31
PDF
202107 - Orion introduction - COSCUP
PDF
Building microservices with grpc
PDF
gRPC and Microservices
PDF
Mасштабирование микросервисов на Go, Matt Heath (Hailo)
PDF
cadec-2017-golang
PPTX
G rpc lection1
PDF
Microservices with gRPC and Kubernetes
gRPC Microservices in Go (MEAP V08) Hüseyin Babal
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
Andrea Di Persio
Yotpo microservices
Build microservice with gRPC in golang
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
Microservices Communication Patterns with gRPC
CloudLand 2023: Rock, Paper, Scissors Cloud Competition - Go vs. Java
A microservice architecture based on golang
Go at uber
A sane approach to microservices
Monolith vs Microservices with Golang at practice - Ivan Kutuzov
What we learnt at carousell tw for golang gathering #31
202107 - Orion introduction - COSCUP
Building microservices with grpc
gRPC and Microservices
Mасштабирование микросервисов на Go, Matt Heath (Hailo)
cadec-2017-golang
G rpc lection1
Microservices with gRPC and Kubernetes
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
Consumable AI The What, Why & How for Small Teams.pdf
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
A review of recent deep learning applications in wood surface defect identifi...
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
Modernising the Digital Integration Hub
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PPT
What is a Computer? Input Devices /output devices
PDF
Five Habits of High-Impact Board Members
PDF
Flame analysis and combustion estimation using large language and vision assi...
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PPTX
Configure Apache Mutual Authentication
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Abstractive summarization using multilingual text-to-text transfer transforme...
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
PDF
Zenith AI: Advanced Artificial Intelligence
Consumable AI The What, Why & How for Small Teams.pdf
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
A review of recent deep learning applications in wood surface defect identifi...
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
NewMind AI Weekly Chronicles – August ’25 Week III
Modernising the Digital Integration Hub
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
What is a Computer? Input Devices /output devices
Five Habits of High-Impact Board Members
Flame analysis and combustion estimation using large language and vision assi...
A contest of sentiment analysis: k-nearest neighbor versus neural network
Configure Apache Mutual Authentication
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Custom Battery Pack Design Considerations for Performance and Safety
Chapter 5: Probability Theory and Statistics
Abstractive summarization using multilingual text-to-text transfer transforme...
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
Zenith AI: Advanced Artificial Intelligence

Intro to microservices GopherDay Taipei '17