This document discusses integrating gRPC services with Kafka to enable end-to-end streaming between gRPC services. It describes how the open source Zilla library can translate between gRPC and Kafka protocols to allow gRPC requests and responses to be sent over Kafka topics. This integration enables features like load balancing, edge caching, and elastic scalability for gRPC services. Examples of using Zilla to implement request-response streaming and server streaming patterns between gRPC and Kafka are provided.
2. 2
From Northern Ireland, UK
California, USA
Now
Experience John Fallows
CTO @ Aklivity
Serial Entrepreneur
HTML5 Contributor
WebSocket Pioneer
25+ years Java
Author Pro JSF & Ajax
JMS, Kafka, gRPC, MQTT, …
grpc-kafka who am i?
3. grpc-kafka what is grpc?
❖ open source RPC (Remote Procedure Call) framework
❖ protocol buffers for service definitions
package example;
service EchoService
{
rpc EchoUnary(EchoMessage) returns (EchoMessage);
}
message EchoMessage
{
string message = 1;
}
4. grpc-kafka why grpc?
❖ strong contract for service definitions
❖ code generation for many languages
❖ protobuf over http/2 optimizes communication
❖ unified http/2 connection per client
5. grpc-kafka grpc challenges
❖ load balancing, client vs proxy, connection vs rpc
❖ limited browser support, requires proxy
❖ binary message format is not human readable
❖ lack of edge caching
6. grpc-kafka compare grpc vs kafka
service
service
service
⚙
service
⚙
service
⚙
service
❖ contract
❖ coupling
❖ communication
❖ codec
7. grpc-kafka integrate grpc + kafka (open source zilla)
Every network and application data flow is a stream.
Streams are composed to create efficient protocol translation pipelines.
shared memory
tcpin
tlsin
httpin
grpcin
kafkaout
tcpout
● Garbage free
● Wait free
● Elastic scalability
● Sliding window flow control
● Multi-core CPU friendly
● Extensible by design
⚙
22. grpc-kafka zilla examples
❖ grpc.kafka.echo
Echoes messages sent to a Kafka topic via gRPC from a gRPC client
❖ grpc.kafka.proxy
Correlates gRPC requests and responses over separate Kafka topics
❖ grpc.kafka.fanout
Streams messages published to a Kafka topic, applying conflation
based on log compaction
❖ …
github.com/aklivity/zilla-examples