SlideShare a Scribd company logo
HTTP
Can we do better?
Challenges,
Debt, and
Cost of Production
Services
Services
Discovery
● Overlay Networks
● Registry/Reverse Proxying
● Port Scanning
● DNS
Discovery:
Overlay Networks
● Slow
● Rather call it host/container
discovery?
● Probably use Docker - Swarm
Discovery: Registry
● Etcd, consul, zookeeper
● Oh no, another cluster?
● How do you add dynamic hosts?
● Proxy could Crash?
● How to find Proxies?
● Connection Draining
● Latency+
● Gateway Partitioning
Discovery:
Reverse Proxies
Discovery:
DNS Based
● No Port based Information
● SRV is cool
○ No one uses it
● Some Languages don’t obey TTL.
● Health-check remains external
process.
Components of Discovery
● Registry
○ Dynamically Configurable
● Registration
○ Clients emit Events
○ Registrar’s sees lack of events
● Health Check
○ Reachability
○ Load
○ Latency
● Load Balancing
○ Client side
○ Server Side
● Server - Side
○ Proxy
○ Haproxy, httpd, consul, nginx etc.
○ ALB, ELB
● Client - Side
○ Netflix OSS
● Algorithm
● Staleness
Load Balancing
○ Round Robin
○ Weighted
Round-Robin
○ Random
○ URL
○ Least Connections
○ Least Traffic
○ Least Latency
○ Recently Used.
Other Essentials
● Request Tracing
● Unified Logging
● Error Reporting
● Wildcard
● HTTP Multicast, Broadcast?
Alternate?
Sample Service
HTTP Way
PubSub/Redis
PubSub Way
Gilmour-Libs
/gilmour-libs
Service Responder
func bindListeners(g *G.Gilmour) {
opts := G.NewHandlerOpts()
g.ReplyTo("action.login", echoReply, opts)
}
func main() {
engine := G.Get(redis.MakeRedis("127.0.0.1:6379", ""))
bindListeners(engine)
engine.Start()
}
Service Caller
func echoRequest(engine *G.Gilmour, msg string) (string, error) {
req := engine.NewRequest("action.login")
resp, err := req.Execute(G.NewMessage().SetData(msg))
if err != nil {
return "", err
}
var output string
err := resp.Next().GetData(&output)
if err != nil {
return "", err
}
return output, nil
}
Request Response
CALLER SERVICE
HELLO?
ALOHA!WRONG NUMBER
SENDER_ID
CODE
No/Good Service Discovery
● No querying discovery process
● Call service and not servers
Load Balancing
Or
Function Point Scaling
Load Balancing - Then
NOTIFICATION
SERVER 1
REPLICATED
LOAD
BALANCER
X.Y.Y.Z
?
CALLER
SERVICE
REGISTER
I, AM
HEALTHY?
NOTIFICATION
SERVER 2
NOTIFICATION
SERVER 3
Load Balancing : Now
NOTIFICATION
SERVER 2
GILMOUR
MANAGER.NOTIFICATION
NOTIFICATION
SERVER 1
NOTIFICATION
SERVER 3
MANAGER.NOTIFICATION
MANAGER.NOTIFICATION
CALLER
SERVICE
MANAGER.NOTIFICATION
{“NOTIFICATION”: “DATA”}
No/Good Load Balancing
● Has Capacity, Will Serve
● Message delivered to one and all
● Fittest node acquires lock first
● No need for Connection draining
And, How?
Just this
func bindListeners(g *G.Gilmour) {
opts := G.NewHandlerOpts().SetGroup("exclusive")
g.ReplyTo("echo", echoReply, opts)
}
Tracing, much?
$: redis-cli MONITOR
1509330865.376313 [0 127.0.0.1:59770] "PUBSUB" "NUMSUB" "gilmour.request.echo"
1509330865.376388 [0 127.0.0.1:59768] "SUBSCRIBE" "gilmour.response.1643e3fc-6362-4a2d-853b-35e8447a63f2"
1509330865.376502 [0 127.0.0.1:59770] "PUBLISH" "gilmour.request.echo" "{"data":"Hello:
World","code":200,"sender":"1643e3fc-6362-4a2d-853b-35e8447a63f2"}"
1509330865.376764 [0 127.0.0.1:59718] "SET" "1643e3fc-6362-4a2d-853b-35e8447a63f2exclusive"
"1643e3fc-6362-4a2d-853b-35e8447a63f2exclusive" "NX" "EX" "600"
1509330865.376928 [0 127.0.0.1:59718] "PUBLISH" "gilmour.response.1643e3fc-6362-4a2d-853b-35e8447a63f2"
"{"data":"Pong Hello:
World","code":200,"sender":"gilmour.response.1643e3fc-6362-4a2d-853b-35e8447a63f2"}"
1509330865.377133 [0 127.0.0.1:59768] "UNSUBSCRIBE" "gilmour.response.1643e3fc-6362-4a2d-853b-35e8447a63f2"
Network practices, much?
How?
# Server Side Timeouts
opts := G.NewHandlerOpts().SetTimeout(500)
g.ReplyTo("echo", echoReply, opts)
# Client Side Timeouts
opts := G.NewRequestOpts().SetTimeout(400)
req := engine.NewRequestWithOpts("action.login", opts)
Logging
How?
G.Logf("action.login %v", "message")
G.Log("action.login")
Errors
What do you do with Errors
● Status Code >= 300 is reported.
● Policy can be:
○ Publish
○ Queue
○ Ignore
func (r *Redis) SetErrorPolicy(policy string) error {
if policy != errorPolicyQueue &&
policy != errorPolicyPublish &&
policy != errorPolicyIgnore {
return errors.New("Invalid policy"))
}
r.errorPolicy = policy
return nil
}
Error Sample
Asynchronous Architectures
HTTP won’t, but
● Queues
● Celery
● SideKiq
● Kafka
● SQS
● Pravega
● Nats
… Can
Asynchronous
EVENT.POWER_UP
EVENT.*
EVENT.*
GROUP: REVENUE
FP SCALING
PUSH MESSAGE
SERVERADS/MARKETINGS
ERVER
UNLOCK LEVEL
BADGE
SERVICE
EVENT.*
ADS/
MARKETING
GAME GILMOUR
(Redis PubSub)
EVENT
EVENT.BRIDGE_FALL
FALL FROM BRIDGEFALL FROM
BRIDGEFALL FROM BRIDGE
GROUP: BRIDGE_FALL
Logging,
Revisited
Service Responder
func bindListeners(g *G.Gilmour) {
opts := G.NewHandlerOpts()
g.Slot("example.log", func(req *G.Request) {
var msg string
if err := req.Data(&msg); err == nil {
log.Println(req.Sender(), "->", msg)
}
}, nil)
}
Asynchronous Caller
func sendLog(engine *G.Gilmour) {
line := "WordCount"
engine.Signal("example.log", G.NewMessage().SetData(line))
line := "Fetching Data"
// err will be not nil, if Message for example.log was not received by anyone.
_, err := engine.Signal("example.log", G.NewMessage().SetData(line))
}
Composition
● compose - service1 | service2 | composition3
● andand - service1 && service2 && composition3
● oror - service1 || composition2 || service3
● batch
○ (service1; service2; service3) > out
○ service1; composition2; service3 > out
● parallel
● lambda functions
Composition
pipe := engine.NewPipe(
engine.NewRequest("example.fetch"),
engine.NewRequest("example.words"),
engine.NewRequest("example.stopfilter"),
engine.NewRequest("example.count"),
engine.NewParallel(
engine.NewRequest("example.popular3"),
engine.NewRequest("example.popular4"),
engine.NewRequest("example.popular5"),
),
)
resp, err := pipe.Execute(G.NewMessage().SetData(url))
expected := []string{}
err := resp.Next().GetData(&expected)
Composition
batch := e.NewPipe(
e.NewRequest("weather.fetch"),
e.NewRequest("weather.group"),
e.NewParallel(
e.NewPipe(
e.NewParallel(
e.NewRequest("weather.min"),
e.NewRequest("weather.max"),
)),
e.NewPipe(
e.NewParallel(
e.NewRequest("weather.min"),
e.NewRequest("weather.max"),
))))
resp, _ := batch.Execute(G.NewMessage().SetData("pune"))
Demo
Examples: Popular Word Count
Given
● A S3 URL pointing to a file that has (lot of) random text
Goal
● Eliminate stop words from the file
● Find most popular 3, 4, and 5 letter words
● Find these in parallel
Output
● Popular 3 letter words: [way, for]
● Popular 4 letter words: [Text, copy]
● Popular 5 letter words: [Blind, blind]
Examples: Weather Aggregation
Examples: Composition
Thank you!
Piyush Verma
@meson10
Oogway
Consulting
http://oogway.in

More Related Content

PPTX
Flink Forward SF 2017: Konstantinos Kloudas - Extending Flink’s Streaming APIs
PDF
No REST - Architecting Real-time Bulk Async APIs
PDF
ORTC SVC SimulCast
PDF
Flink Forward SF 2017: Jamie Grier - Apache Flink - The latest and greatest
PDF
Beyond Breakpoints: A Tour of Dynamic Analysis
PDF
Asynchronní programování
DOCX
Vhdl programs
ODP
Hello Java 8
Flink Forward SF 2017: Konstantinos Kloudas - Extending Flink’s Streaming APIs
No REST - Architecting Real-time Bulk Async APIs
ORTC SVC SimulCast
Flink Forward SF 2017: Jamie Grier - Apache Flink - The latest and greatest
Beyond Breakpoints: A Tour of Dynamic Analysis
Asynchronní programování
Vhdl programs
Hello Java 8

What's hot (17)

PDF
Apache Flink Training Workshop @ HadoopCon2016 - #4 Advanced Stream Processing
PPTX
NGINX_conf_2016_talk
PDF
Reactive cocoa made Simple with Swift
PPTX
End to end testing a web application with Clojure
PDF
Flink Forward SF 2017: Stefan Richter - Improvements for large state and reco...
PDF
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
PPTX
Kostas Kloudas - Extending Flink's Streaming APIs
PDF
Reactive mistakes - ScalaDays Chicago 2017
PDF
ReactiveCocoa in Practice
PDF
Log Event Stream Processing In Flink Way
PDF
Orbiter and how to extend Docker Swarm
PPTX
About time
PPTX
Introduction to Service Workers | Matteo Manchi
PDF
Flink Forward Berlin 2017: Aljoscha Krettek - Talk Python to me: Stream Proce...
PDF
Distributed Real-Time Stream Processing: Why and How 2.0
PDF
Reactive mistakes reactive nyc
PDF
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overview
Apache Flink Training Workshop @ HadoopCon2016 - #4 Advanced Stream Processing
NGINX_conf_2016_talk
Reactive cocoa made Simple with Swift
End to end testing a web application with Clojure
Flink Forward SF 2017: Stefan Richter - Improvements for large state and reco...
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
Kostas Kloudas - Extending Flink's Streaming APIs
Reactive mistakes - ScalaDays Chicago 2017
ReactiveCocoa in Practice
Log Event Stream Processing In Flink Way
Orbiter and how to extend Docker Swarm
About time
Introduction to Service Workers | Matteo Manchi
Flink Forward Berlin 2017: Aljoscha Krettek - Talk Python to me: Stream Proce...
Distributed Real-Time Stream Processing: Why and How 2.0
Reactive mistakes reactive nyc
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overview
Ad

Similar to Microservice Architecture - Beyond HTTP (20)

PDF
Client-Server-Kommunikation mit dem Command Pattern
PDF
Database Drivers: Performance Perspectives by Piotr Sarna
PDF
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
ODP
CRUD Operation With Dgraph
ODP
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
ODP
Intravert Server side processing for Cassandra
PPTX
Nagios Conference 2014 - Jim Prins - Passive Monitoring with Nagios
PDF
Boosting Angular runtime performance
PDF
ProxySQL at Scale on AWS.pdf
PPTX
Sprint 16 report
PDF
The powerful toolset of the go-mysql library
PDF
Build microservice with gRPC in golang
PDF
Tweaking performance on high-load projects
PDF
gRPC in Go
PDF
Serverless architecture: introduction & first steps
PDF
How to Leverage Go for Your Networking Needs
PDF
Consul scale
PPTX
Debugging Your Debugging Tools: What to do When Your Service Mesh Goes Down
PDF
Monitoring with Syslog and EventMachine
PDF
Getting by with just psql
Client-Server-Kommunikation mit dem Command Pattern
Database Drivers: Performance Perspectives by Piotr Sarna
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
CRUD Operation With Dgraph
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
Intravert Server side processing for Cassandra
Nagios Conference 2014 - Jim Prins - Passive Monitoring with Nagios
Boosting Angular runtime performance
ProxySQL at Scale on AWS.pdf
Sprint 16 report
The powerful toolset of the go-mysql library
Build microservice with gRPC in golang
Tweaking performance on high-load projects
gRPC in Go
Serverless architecture: introduction & first steps
How to Leverage Go for Your Networking Needs
Consul scale
Debugging Your Debugging Tools: What to do When Your Service Mesh Goes Down
Monitoring with Syslog and EventMachine
Getting by with just psql
Ad

Recently uploaded (20)

PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
PPT on Performance Review to get promotions
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Construction Project Organization Group 2.pptx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Fundamentals of Mechanical Engineering.pptx
PDF
Well-logging-methods_new................
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
737-MAX_SRG.pdf student reference guides
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
Sustainable Sites - Green Building Construction
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
DOCX
573137875-Attendance-Management-System-original
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
CYBER-CRIMES AND SECURITY A guide to understanding
PPT on Performance Review to get promotions
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Construction Project Organization Group 2.pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Fundamentals of Mechanical Engineering.pptx
Well-logging-methods_new................
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
737-MAX_SRG.pdf student reference guides
Safety Seminar civil to be ensured for safe working.
Sustainable Sites - Green Building Construction
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
UNIT 4 Total Quality Management .pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
573137875-Attendance-Management-System-original
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...

Microservice Architecture - Beyond HTTP