1
Kafka and the Service Mesh
Gwen Shapira, Principal Data Architect
@gwenshap
You Have Microservices
2
They need to communicate
3
4
Orders
Returns
?
Invento
ry
Fulfill
Order
Validat
e Order
I know! I’ll use REST APIs
Synchronous request-response communication
Leads to
Tight point-to-point coupling
5
6
Making Changes is Risky
Change
7
Adding Services Requires Explicit Calls
Mistak
e
Handle
r
All these lines of communication require:
Logging, monitoring, error handling and more
8
The most difficult thing about microservices
is data.
Especially joining data.
9
We need a way to communicate that is:
Decoupled
Flexible
Operationally Transparent
Data Aware
10
Kafka?
11
15
From This:
16
To This:
17
And This: New
Servi
ce
Kafka:
- Immutable, ordered, stream (log) of events
- Highly Available
- Scalable
- Load balancing consumers
- HA consumers
- (Potentially) infinite storage
Kafka + Schema Registry
20
APIs between services are Contracts
In Stream Processing World – Event Schemas ARE the API
…except they stick around for a lot longer
We need a way to communicate that is:
Decoupled
Flexible
Operationally Transparent
Data Aware
27
Service Mesh?
28
It is a proxy.
Sidecar:
Components of the application, deployed in a separate
container to provide isolation and encapsulation.
This pattern allows applications to be composed of
heterogeneous components.
31
Proxy as sidecar:
Proxy
Proxy
Proxy
Proxy
Proxy
Proxy
I have a new
IP now.
YOLO!
Who
cares?
I magically
know all
about it!
Proxy
I can recover
from errors
without drowning
Error?
No worries!
Lets retry every
millisecond forever
LOL. I’m
dropping 99%
of the retries.
Cool Things proxies do!
- One stable uri for each service
- Service discovery
- Log requests
- Monitor request latency
- Routing - A/B testing, green/blue deployments
- Circuit breaking
- Protocol translation
- SSL Termination
They don’t do it alone
We need a way to communicate that is:
Decoupled
Flexible
Operationally Transparent
Data Aware
37
How do we choose?
38
40
Two different paradigms
Request-Response Events Streams
- Very Low latency
- Often sync
- Point-to-point
- “Bespoke API”
- Continuous processing
- Often async
- Event driven
- General-purpose events
Vision #1:
Using Service Mesh to hide Kafka
Introduce
Proxy
I am somehow
getting events
from Kafka
I’m using REST to
talk to a service
I’m really re-
directing
events to
Kafka
REST Proxy does bits of that.
HTTP on one-side, Kafka on the other.
We are adding more protocols:
- JMS
- MQTT
- gRPC
Vision #2:
Kafka as part of control plane
Proxy
I am using REST too!
Kafka? Never heard of
her.I’m using REST to
talk to a service
I’m proxying
REST.
And also
logging stuff to
Kafka
Vision #3:
Kafka as a Service in a Mesh
47
Like This:
Proxy
Proxy
Proxy
Proxy
Proxy
Vision #4:
Front Kafka
52
Like This:
P
R
O
X
Y
P
R
O
X
Y
Lets Sum Things Up
53
- REST API point-to-point communication
hits the wall
- Service Mesh adds discovery and operationalibility
- Kafka adds data, compatibility, immutable storage
- You can have both. In many different tastes.
- Coming soon to a proxy near you
Resources and Next Steps
https://github.com/confluentinc/cp-demo
https://www.confluent.io/download/
https://slackpass.io/confluentcommunity
https://www.confluent.io/blog
https://www.confluent.io/confluent-operator/
https://github.com/envoyproxy/envoy/issues/2852

Gluecon - Kafka and the service mesh

Editor's Notes

  • #2 Good afternoon, I’m Gwen Shapira. Glad to be here with you. This talk is kind of… experimental. When I first learned about Service Mesh, I got the impression that it solves similar problems as Apache Kafka, but from a completely different direction. In this talk, I want to explore the problem space, why I think Kafka and Service Mesh do similar things, the trade-offs involved and how these two solutions compliment each other.
  • #5 The basic idea that most people end up with is that if one service needs another service to do something, it will use a REST API and call that service and ask it to do something.
  • #10 Joining data sets Exposing data Evolving data
  • #42 Basically let apps talk REST request-response like they always did, but magically get events to Kafka in order to grow
  • #49 You can see a practically endless list of feature requests
  • #56 This is open source, and you should get involved. You can check out the code on GitHub or play with the many examples there. Also, you are hereby solemnly adjured to join the Slack community and ask questions there!