source: DataEngConf 2016, Hakka Labs speakers: Krishna Gade, Yu Yang youtube:uri
_______ ____________
|Storm |--->| Stingray |----------, __
'--,,--' '\________/' \-| |
,->["]---s-, _|________ | PRODUCT
/ backend \ |[][][][][]| _________________ |__|
[Mob]--->["]---s---->|_KAFKA____| [Pinbal | Skyline] '|'
[App]\ app / | '----------------' /
'->["]---s-' .|, ____'|'___,|.____,--'-->[Pinalytics]
\ |--------| | Qubole | \
*Singer | Merced | |_(Hadoop,Spark)__| \->[A/B Testing]
|________| '|' ,|. |
\________,[{S3}{S3}{S3}] '->[Redshift]
-
1000s of hosts
-
'>120 billion' messages, 10s Terabytes per day
-
'>500' kafka brokers as central message transportation hub
KAFKA_0.7_ Real-time consumers
|Host| |[][][][][][][] |--->[Apache Storm]
[Mob]<-->[app]-->|[data uploader]|
[App] [app]-->|_______________|-->[{S3}]-->[hadoop]
[app]-'
-
no replication, data loss on broker failure or high back-pressure
-
broker replacement, reboot all dependent services to pick up the latest broker list
topic leader partition can change frequently
-
multiple copies among brokers, directly persisting need to know which broker is the leader of topic partition
-
can't randomly pick Kafka brokers to write, need leader of each topic partition
-
handle corner cases like when a kafka partition is unavailable, or in middle of leader election
KAFKA_0.8_______ Real-time consumers
|Host| |[][][][][][][] |--->[Apache Storm, Spark]
[Mob]<-->[app] |[data uploader]|
[App] [app] |_______________| [Sanitizer]
.|, / .|, '|' .|,
[Singer],' [Secor/Merced]-->[{S3}]-->[hadoop]
Applications log to disk, Singer monitors filesystem events and uploads to Kafka.
Isolate applications from Singer agent failures. Isolate applications from Kafka failures.
More than 100MB/second for log files in Thrift.
Production environment support
- dynamic configuration detection
- adjustable log uploading latency
- auditing
- heartbeat mechanism
Staged Event Driven Architecture
|Log.Configuration|
|================|<------[Configuration.Watcher]
|===============| _____________
| _ |Reader--> |
.|, ,-->|_| [] [] -->|_-->Writer__|-, /''''\
|'''''''''''''--' _ _____________ \ |Log |
| Log.Stream |------>|_| [] [] -->|Reader--> | \|Repo|
| Monitor |---, |_-->Writer__|----| |
|____________| \ _ _____________ / \____/
->|_| [] [] -->|Reader--> |-'
|_--Writer___|
- brokers can die unexpectedly
- disk i/o perf can degrade due to resource contention
- avoid virtual hosts co-location on same physical host
- faster recovery
- started with c3.2xlarge+EBS
- now d2.xlarge, local disks to avoid EBS contention
- minimize data on each broker for faster recovery
- availability zone aware topic partition allocation
- multiple small clusters (20-40 brokers) for topic isolation
- atomic consistency
- fault tolreance
- load distribution
- horizontal scalability
- configurable upload policies
- uses high-level Kafka Consumer distributed over multiple workers
- uses ZK to keep track of each topic from workers to avoid duplication, strong consistency
- fault-tolreant, workers can crash and load is managed
- kafka consumer group re-balancing prevent consumer from making progress in high data volume
- worsen by high-level consumer lags behind same topic partitions
- manual tuning for workload distribution
- inconvenient to add new topics
- central workload distribution
- master-worker topology decoupled with Zookeeper to keep tap on others
- master creates tasks, workers pick up and perform, master keeps track of progress