Top Banner
BUILDING KAFKA-POWERED MESSAGE BUS Activity Stream and beyond
20

Building Kafka-powered Activity Stream

Mar 19, 2017

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Building Kafka-powered Activity Stream

BUILDING KAFKA-POWERED MESSAGE BUS

Activity Stream and beyond

Page 2: Building Kafka-powered Activity Stream

CHALLENGES

➤ Needed a way to aggregate project-related activity information generated by various services in one place

➤ Needed a messaging backbone to carry messages between services

Page 3: Building Kafka-powered Activity Stream

SOLUTIONS

➤ Activity Stream on the product side

➤ Message Bus on the tech side

Page 4: Building Kafka-powered Activity Stream

“ A Message Bus is a combination of a common data model, a common command set, and a messaging infrastructure to allow different systems to communicate through a shared set of interfaces.

- "Enterprise Integration Patterns"

Page 5: Building Kafka-powered Activity Stream

Apache Kafka

is publish-subscribe messaging

rethought as a distributed commit log.

by

Page 6: Building Kafka-powered Activity Stream

WHY KAFKA?

Page 7: Building Kafka-powered Activity Stream

KAFKA IS FAST

A single Kafka broker can handle hundreds of megabytes of reads and writes per second from thousands of clients.

Page 8: Building Kafka-powered Activity Stream

KAFKA IS SCALABLE

➤ Kafka is designed to allow a single cluster to serve as the central data backbone for a large organization.

➤ It can be elastically and transparently expanded without downtime.

➤ Data streams are partitioned and spread over a cluster of machines to allow data streams larger than the capability of any single machine and to allow clusters of co-ordinated consumers.

Page 9: Building Kafka-powered Activity Stream

KAFKA IS DURABLE

➤ Messages are persisted on disk and replicated within the cluster to prevent data loss.

➤ Each broker can handle terabytes of messages without performance impact.

Page 10: Building Kafka-powered Activity Stream

KAFKA IS DISTRIBUTED BY DESIGN

Kafka has a modern cluster-centric design that offers strong durability and fault-tolerance guarantees.

Page 11: Building Kafka-powered Activity Stream

GENERAL SETUP

Page 12: Building Kafka-powered Activity Stream

READING / WRITING TO A TWO-PARTITION TOPIC

Page 13: Building Kafka-powered Activity Stream
Page 14: Building Kafka-powered Activity Stream

CONSUMER GROUPS

Page 15: Building Kafka-powered Activity Stream

MESSAGE BUS GEM

A simple Ruby interface to Apache Kafka.

https://github.com/crealytics/message_bus

Page 16: Building Kafka-powered Activity Stream

Camato Shopping

… service

Mesosphere

GewgawConsumer

Bishop

OUR SETUP

MessageBus

Producer

MessageBus

Producer

… service

MessageBus

Producer

Kafka cluster

Message Bus

Consumer

TrafficDirector run

DBActivity Stream

… service

Message Bus

Consumer

event message

event message

persistence

Page 17: Building Kafka-powered Activity Stream

ACTIVITY STREAM

Page 18: Building Kafka-powered Activity Stream

NEXT STEPS

➤ Keep adding messages (and message types) to Activity Stream

➤ Keep improving MessageBus gem

➤ Ensure proper production-ready Kafka setup

➤ Use Message Bus for decoupling service APIs and inter-service communication

➤ Asynchronous only, needs more research

➤ Input from Martin Mauch: use CrealyticsLogger to push JSON messages to Kafka (?) — under consideration

Page 19: Building Kafka-powered Activity Stream

DEMO

Page 20: Building Kafka-powered Activity Stream

DANKE!