• Stars
    star
    2,734
  • Rank 16,652 (Top 0.4 %)
  • Language
    Java
  • License
    BSD 2-Clause "Sim...
  • Created over 7 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cruise-control is the first of its kind to fully automate the dynamic workload rebalance and self-healing of a Kafka cluster. It provides great value to Kafka users by simplifying the operation of Kafka clusters.

Cruise Control for Apache Kafka

CircleCI

Introduction

Cruise Control is a product that helps run Apache Kafka clusters at large scale. Due to the popularity of Apache Kafka, many companies have bigger and bigger Kafka clusters. At LinkedIn, we have ~7K+ Kafka brokers, which means broker deaths are an almost daily occurrence and balancing the workload of Kafka also becomes a big overhead.

Kafka Cruise Control is designed to address this operation scalability issue.

Features

Kafka Cruise Control provides the following features out of the box:

  • Resource utilization tracking for brokers, topics, and partitions.

  • Query the current Kafka cluster state to see the online and offline partitions, in-sync and out-of-sync replicas, replicas under min.insync.replicas, online and offline logDirs, and distribution of replicas in the cluster.

  • Multi-goal rebalance proposal generation for:

    • Rack-awareness
    • Resource capacity violation checks (CPU, DISK, Network I/O)
    • Per-broker replica count violation check
    • Resource utilization balance (CPU, DISK, Network I/O)
    • Leader traffic distribution
    • Replica distribution for topics
    • Global replica distribution
    • Global leader replica distribution
    • Custom goals that you wrote and plugged in
  • Anomaly detection, alerting, and self-healing for the Kafka cluster, including:

    • Goal violation
    • Broker failure detection
    • Metric anomaly detection
    • Disk failure detection (not available in kafka_0_11_and_1_0 branch)
    • Slow broker detection (not available in kafka_0_11_and_1_0 branch)
  • Admin operations, including:

    • Add brokers
    • Remove brokers
    • Demote brokers
    • Rebalance the cluster
    • Fix offline replicas (not available in kafka_0_11_and_1_0 branch)
    • Perform preferred leader election (PLE)
    • Fix offline replicas
    • Adjust replication factor

Environment Requirements

  • The main (previously migrate_to_kafka_2_5) branch of Cruise Control is compatible with Apache Kafka 2.5+ (i.e. Releases with 2.5.*), 2.6 (i.e. Releases with 2.5.11+), 2.7 (i.e. Releases with 2.5.36+), 2.8 (i.e. Releases with 2.5.66+), 3.0 (i.e. Releases with 2.5.85+), and 3.1 (i.e. Releases with 2.5.85+).
  • The migrate_to_kafka_2_4 branch of Cruise Control is compatible with Apache Kafka 2.4 (i.e. Releases with 2.4.*).
  • The kafka_2_0_to_2_3 branch (deprecated) of Cruise Control is compatible with Apache Kafka 2.0, 2.1, 2.2, and 2.3 (i.e. Releases with 2.0.*).
  • The kafka_0_11_and_1_0 branch (deprecated) of Cruise Control is compatible with Apache Kafka 0.11.0.0, 1.0, and 1.1 (i.e. Releases with 0.1.*).
  • message.format.version 0.10.0 and above is needed.
  • The kafka_2_0_to_2_3 and kafka_0_11_and_1_0 branches compile with Scala 2.11.
  • The branch migrate_to_kafka_2_4 compiles with Scala 2.12.
  • The branch migrate_to_kafka_2_5 compile with Scala 2.13.
  • This project requires Java 11.

Known Compatibility Issues

  • Support for Apache Kafka 2.0, 2.1, 2.2, and 2.3 requires KAFKA-8875 hotfix.

Quick Start

  1. Get Cruise Control
    1. (Option-1): via git clone
      • git clone https://github.com/linkedin/cruise-control.git && cd cruise-control/
    2. (Option-2): via browsing the available releases:
      • Browse https://github.com/linkedin/cruise-control/releases to pick a release -- e.g. 0.1.10
      • Get and extract the release: wget https://github.com/linkedin/cruise-control/archive/0.1.10.tar.gz && tar zxvf 0.1.10.tar.gz && cd cruise-control-0.1.10/
      • Initialize the local repo: git init && git add . && git commit -m "Init local repo." && git tag -a 0.1.10 -m "Init local version."
  2. This step is required if CruiseControlMetricsReporter is used for metrics collection (i.e. the default for Cruise Control). The metrics reporter periodically samples the Kafka raw metrics on the broker and sends them to a Kafka topic.
    • ./gradlew jar (Note: This project requires Java 11)
    • Copy ./cruise-control-metrics-reporter/build/libs/cruise-control-metrics-reporter-A.B.C.jar (Where A.B.C is the version of the Cruise Control) to your Kafka server dependency jar folder. For Apache Kafka, the folder would be core/build/dependant-libs-SCALA_VERSION/ (for a Kafka source checkout) or libs/ (for a Kafka release download).
    • Modify Kafka server configuration to set metric.reporters to com.linkedin.kafka.cruisecontrol.metricsreporter.CruiseControlMetricsReporter. For Apache Kafka, server properties are located at ./config/server.properties.
    • If SSL is enabled, ensure that the relevant client configurations are properly set for all brokers in ./config/server.properties. Note that CruiseControlMetricsReporter takes all configurations for vanilla KafkaProducer with a prefix of cruise.control.metrics.reporter. -- e.g. cruise.control.metrics.reporter.ssl.truststore.password.
    • If the default broker cleanup policy is compact, make sure that the topic to which Cruise Control metrics reporter should send messages is created with the delete cleanup policy -- the default metrics reporter topic is __CruiseControlMetrics.
  3. Start ZooKeeper and Kafka server (See tutorial).
  4. Modify config/cruisecontrol.properties of Cruise Control:
    • (Required) fill in bootstrap.servers and zookeeper.connect to the Kafka cluster to be monitored.
    • (Required) update capacity.config.file to the path of your capacity file.
      • Capacity file is a JSON file that provides the capacity of the brokers
      • You can start Cruise Control server with the default file (config/capacityJBOD.json), but it may not reflect the actual capacity of the brokers
      • See BrokerCapacityConfigurationFileResolver configurations for more information and examples
    • (Optional) set metric.sampler.class to your implementation (the default sampler class is CruiseControlMetricsReporterSampler)
    • (Optional) set sample.store.class to your implementation if you have one (the default SampleStore is KafkaSampleStore)
  5. Run the following command
    ./gradlew jar copyDependantLibs
    ./kafka-cruise-control-start.sh [-jars PATH_TO_YOUR_JAR_1,PATH_TO_YOUR_JAR_2] config/cruisecontrol.properties [port]
    
    JAR files correspond to your applications and port enables customizing the Cruise Control port number (default: 9090).
    • (Note) To emit Cruise Control JMX metrics on a particular port (e.g. 56666), export JMX_PORT=56666 before running kafka-cruise-control-start.sh
  6. (Verify your setup) Visit http://localhost:9090/kafkacruisecontrol/state (or http://localhost:\[port\]/kafkacruisecontrol/state if you specified the port when starting Cruise Control).

Note:

  • Cruise Control will need some time to read the raw Kafka metrics from the cluster.
  • The metrics of a newly up broker may take a few minutes to get stable. Cruise Control will drop the inconsistent metrics (e.g when topic bytes-in is higher than broker bytes-in), so first few windows may not have enough valid partitions.

REST API

Cruise Control provides a REST API for users to interact with. See the wiki page for more details.

How Does It Work

Cruise Control relies on the recent load information of replicas to optimize the cluster.

Cruise Control periodically collects resource utilization samples at both broker- and partition-level to infer the traffic pattern of each partition. Based on the traffic characteristics and distribution of all the partitions, it derives the load impact of each partition over the brokers. Cruise Control then builds a workload model to simulate the workload of the Kafka cluster. The goal optimizer explores different ways to generate cluster workload optimization proposals based on the user-specified list of goals.

Cruise Control also monitors the liveness of all the brokers in the cluster. To avoid the loss of redundancy, Cruise Control automatically moves replicas from failed brokers to alive ones.

For more details about how Cruise Control achieves that, see these slides.

Configurations for Cruise Control

To read more about the configurations. Check the configurations wiki page.

Artifactory

Published at Jfrog Artifactory. See available releases.

Pluggable Components

More about pluggable components can be found in the pluggable components wiki page.

Metric Sampler

The metric sampler enables users to deploy Cruise Control to various environments and work with the existing metric systems.

Cruise Control provides a metrics reporter that can be configured in your Apache Kafka server. Metrics reporter generates performance metrics to a Kafka metrics topic that can be consumed by Cruise Control.

Sample Store

The Sample Store enables storage of collected metric samples and training samples in an external storage.

Metric sampling uses derived data from the raw metrics, and the accuracy of the derived data depends on the metadata of the cluster at that point. Hence, when we look at the old metrics, if we do not know the metadata at the point the metric was collected, the derived data would not be accurate. Sample Store helps solving this problem by storing the derived data directly to an external storage for later loading.

The default Sample Store implementation produces metric samples back to Kafka.

Goals

The goals in Cruise Control are pluggable with different priorities. The default goals in order of decreasing priority are:

  • RackAwareGoal - Ensures that all replicas of each partition are assigned in a rack aware manner -- i.e. no more than one replica of each partition resides in the same rack.
  • RackAwareDistributionGoal - A relaxed version of RackAwareGoal. Contrary to RackAwareGoal, as long as replicas of each partition can achieve a perfectly even distribution across the racks, this goal lets placement of multiple replicas of a partition into a single rack.
  • MinTopicLeadersPerBrokerGoal - Ensures that each alive broker has at least a certain number of leader replica of each topic in a configured set of topics
  • ReplicaCapacityGoal - Ensures that the maximum number of replicas per broker is under the specified maximum limit.
  • DiskCapacityGoal - Ensures that Disk space usage of each broker is below a given threshold.
  • NetworkInboundCapacityGoal - Ensures that inbound network utilization of each broker is below a given threshold.
  • NetworkOutboundCapacityGoal - Ensures that outbound network utilization of each broker is below a given threshold.
  • CpuCapacityGoal - Ensures that CPU utilization of each broker is below a given threshold.
  • ReplicaDistributionGoal - Attempts to make all the brokers in a cluster have a similar number of replicas.
  • PotentialNwOutGoal - Ensures that the potential network output (when all the replicas in the broker become leaders) on each of the broker do not exceed the broker’s network outbound bandwidth capacity.
  • DiskUsageDistributionGoal - Attempts to keep the Disk space usage variance among brokers within a certain range relative to the average Disk utilization.
  • NetworkInboundUsageDistributionGoal - Attempts to keep the inbound network utilization variance among brokers within a certain range relative to the average inbound network utilization.
  • NetworkOutboundUsageDistributionGoal - Attempts to keep the outbound network utilization variance among brokers within a certain range relative to the average outbound network utilization.
  • CpuUsageDistributionGoal - Attempts to keep the CPU usage variance among brokers within a certain range relative to the average CPU utilization.
  • LeaderReplicaDistributionGoal - Attempts to make all the brokers in a cluster have a similar number of leader replicas.
  • LeaderBytesInDistributionGoal - Attempts to equalize the leader bytes in rate on each host.
  • TopicReplicaDistributionGoal - Attempts to maintain an even distribution of any topic's partitions across the entire cluster.
  • PreferredLeaderElectionGoal - Simply move the leaders to the first replica of each partition.
  • KafkaAssignerDiskUsageDistributionGoal - (Kafka-assigner mode) Attempts to distribute disk usage evenly among brokers based on swap.
  • IntraBrokerDiskCapacityGoal - (Rebalance-disk mode, not available in kafka_0_11_and_1_0 branch) Ensures that Disk space usage of each disk is below a given threshold.
  • IntraBrokerDiskUsageDistributionGoal - (Rebalance-disk mode, not available in kafka_0_11_and_1_0 branch) Attempts to keep the Disk space usage variance among disks within a certain range relative to the average broker Disk utilization.

Anomaly Notifier

The anomaly notifier allows users to be notified when an anomaly is detected. Anomalies include:

  • Broker failure
  • Goal violation
  • Metric anomaly
  • Disk failure (not available in kafka_0_11_and_1_0 branch)
  • Slow brokers (not available in kafka_0_11_and_1_0 branch)
  • Topic replication factor anomaly (not available in kafka_0_11_and_1_0 branch)
  • Topic partition size anomaly (not available in kafka_0_11_and_1_0 branch)
  • Maintenance Events (not available in kafka_0_11_and_1_0 branch)

In addition to anomaly notifications, users can enable actions to be taken in response to an anomaly by turning self-healing on for the relevant anomaly detectors. Multiple anomaly detectors work in harmony using distinct mitigation mechanisms. Their actions broadly fall into the following categories:

  • fix - fix the problem right away (e.g. start a rebalance, fix offline replicas)
  • check - check the situation again after a configurable delay (e.g. adopt a grace period before fixing broker failures)
  • ignore - ignore the anomaly (e.g. self-healing is disabled)

More Repositories

1

school-of-sre

At LinkedIn, we are using this curriculum for onboarding our entry-level talents into the SRE role.
HTML
7,821
star
2

css-blocks

High performance, maintainable stylesheets.
TypeScript
6,335
star
3

Burrow

Kafka Consumer Lag Checking
Go
3,725
star
4

databus

Source-agnostic distributed change data capture system
Java
3,636
star
5

Liger-Kernel

Efficient Triton Kernels for LLM Training
Python
3,312
star
6

qark

Tool to look for several security related Android application vulnerabilities
Python
3,183
star
7

dustjs

Asynchronous Javascript templating for the browser and server
JavaScript
2,911
star
8

rest.li

Rest.li is a REST+JSON framework for building robust, scalable service architectures using dynamic discovery and simple asynchronous APIs.
Java
2,500
star
9

kafka-monitor

Xinfra Monitor monitors the availability of Kafka clusters by producing synthetic workloads using end-to-end pipelines to obtain derived vital statistics - E2E latency, service produce/consume availability, offsets commit availability & latency, message loss rate and more.
Java
2,016
star
10

dexmaker

A utility for doing compile or runtime code generation targeting Android's Dalvik VM
Java
1,863
star
11

greykite

A flexible, intuitive and fast forecasting library
Python
1,813
star
12

ambry

Distributed object store
Java
1,740
star
13

shiv

shiv is a command line utility for building fully self contained Python zipapps as outlined in PEP 441, but with all their dependencies included.
Python
1,729
star
14

swift-style-guide

LinkedIn's Official Swift Style Guide
1,430
star
15

dr-elephant

Dr. Elephant is a job and flow-level performance monitoring and tuning tool for Apache Hadoop and Apache Spark
Java
1,353
star
16

detext

DeText: A Deep Neural Text Understanding Framework for Ranking and Classification Tasks
Python
1,263
star
17

luminol

Anomaly Detection and Correlation library
Python
1,182
star
18

parseq

Asynchronous Java made easier
Java
1,165
star
19

oncall

Oncall is a calendar tool designed for scheduling and managing on-call shifts. It can be used as source of dynamic ownership info for paging systems like http://iris.claims.
Python
1,137
star
20

test-butler

Reliable Android Testing, at your service
Java
1,046
star
21

goavro

Go
972
star
22

PalDB

An embeddable write-once key-value store written in Java
Java
937
star
23

brooklin

An extensible distributed system for reliable nearline data streaming at scale
Java
919
star
24

iris

Iris is a highly configurable and flexible service for paging and messaging.
Python
807
star
25

photon-ml

A scalable machine learning library on Apache Spark
Terra
793
star
26

URL-Detector

A Java library to detect and normalize URLs in text
Java
782
star
27

coral

Coral is a translation, analysis, and query rewrite engine for SQL and other relational languages.
Java
781
star
28

Hakawai

A powerful, extensible UITextView.
Objective-C
781
star
29

eyeglass

NPM Modules for Sass
TypeScript
741
star
30

opticss

A CSS Optimizer
TypeScript
715
star
31

LiTr

Lightweight hardware accelerated video/audio transcoder for Android.
Java
609
star
32

kafka-tools

A collection of tools for working with Apache Kafka.
Python
592
star
33

pygradle

Using Gradle to build Python projects
Java
587
star
34

flashback

mock the internet
Java
578
star
35

FeatureFu

Library and tools for advanced feature engineering
Java
568
star
36

LayoutTest-iOS

Write unit tests which test the layout of a view in multiple configurations
Objective-C
564
star
37

FastTreeSHAP

Fast SHAP value computation for interpreting tree-based models
Python
509
star
38

venice

Venice, Derived Data Platform for Planet-Scale Workloads.
Java
487
star
39

Spyglass

A library for mentions on Android
Java
386
star
40

dagli

Framework for defining machine learning models, including feature generation and transformations, as directed acyclic graphs (DAGs).
Java
353
star
41

cruise-control-ui

Cruise Control Frontend (CCFE): Single Page Web Application to Manage Large Scale of Kafka Clusters
Vue
337
star
42

ml-ease

ADMM based large scale logistic regression
Java
333
star
43

openhouse

Open Control Plane for Tables in Data Lakehouse
Java
304
star
44

dph-framework

HTML
298
star
45

transport

A framework for writing performant user-defined functions (UDFs) that are portable across a variety of engines including Apache Spark, Apache Hive, and Presto.
Java
296
star
46

spark-tfrecord

Read and write Tensorflow TFRecord data from Apache Spark.
Scala
288
star
47

isolation-forest

A Spark/Scala implementation of the isolation forest unsupervised outlier detection algorithm with support for exporting in ONNX format.
Scala
224
star
48

LiFT

The LinkedIn Fairness Toolkit (LiFT) is a Scala/Spark library that enables the measurement of fairness in large scale machine learning workflows.
Scala
168
star
49

shaky-android

Shake to send feedback for Android.
Java
160
star
50

pyexchange

Python wrapper for Microsoft Exchange
Python
153
star
51

asciietch

A graphing library with the goal of making it simple to graphs using ascii characters.
Python
138
star
52

python-avro-json-serializer

Serializes data into a JSON format using AVRO schema.
Python
137
star
53

gdmix

A deep ranking personalization framework
Python
131
star
54

li-apache-kafka-clients

li-apache-kafka-clients is a wrapper library for the Apache Kafka vanilla clients. It provides additional features such as large message support and auditing to the Java producer and consumer in the open source Apache Kafka.
Java
131
star
55

dynamometer

A tool for scale and performance testing of HDFS with a specific focus on the NameNode.
Java
131
star
56

Avro2TF

Avro2TF is designed to fill the gap of making users' training data ready to be consumed by deep learning training frameworks.
Scala
126
star
57

datahub-gma

General Metadata Architecture
Java
121
star
58

linkedin-gradle-plugin-for-apache-hadoop

Groovy
117
star
59

dex-test-parser

Find all test methods in an Android instrumentation APK
Kotlin
106
star
60

cassette

An efficient, file-based FIFO Queue for iOS and macOS.
Objective-C
95
star
61

spaniel

LinkedIn's JavaScript viewport tracking library and IntersectionObserver polyfill
JavaScript
92
star
62

Hoptimator

Multi-hop declarative data pipelines
Java
91
star
63

migz

Multithreaded, gzip-compatible compression and decompression, available as a platform-independent Java library and command-line utilities.
Java
79
star
64

avro-util

Collection of utilities to allow writing java code that operates across a wide range of avro versions.
Java
76
star
65

sysops-api

sysops-api is a framework designed to provide visability from tens of thousands of machines in seconds.
Python
74
star
66

iceberg

A temporary home for LinkedIn's changes to Apache Iceberg (incubating)
Java
62
star
67

DuaLip

DuaLip: Dual Decomposition based Linear Program Solver
Scala
59
star
68

kube2hadoop

Secure HDFS Access from Kubernetes
Java
59
star
69

dynoyarn

DynoYARN is a framework to run simulated YARN clusters and workloads for YARN scale testing.
Java
58
star
70

linkedin.github.com

Listing of all our public GitHub projects.
JavaScript
58
star
71

Tachyon

An Android library that provides a customizable calendar day view UI widget.
Java
57
star
72

Cytodynamics

Classloader isolation library.
Java
49
star
73

iris-relay

Stateless reverse proxy for thirdparty service integration with Iris API.
Python
48
star
74

concurrentli

Classes for multithreading that expand on java.util.concurrent, adding convenience, efficiency and new tools to multithreaded Java programs
Java
46
star
75

iris-mobile

A mobile interface for linkedin/iris, built for iOS and Android on the Ionic platform
TypeScript
42
star
76

lambda-learner

Lambda Learner is a library for iterative incremental training of a class of supervised machine learning models.
Python
41
star
77

TE2Rules

Python library to explain Tree Ensemble models (TE) like XGBoost, using a rule list.
Python
40
star
78

instantsearch-tutorial

Sample code for building an end-to-end instant search solution
JavaScript
39
star
79

PASS-GNN

Python
38
star
80

self-focused

Helps make a single page application more friendly to screen readers.
JavaScript
35
star
81

tracked-queue

An autotracked implementation of a ring-buffer-backed double-ended queue
TypeScript
35
star
82

QueryAnalyzerAgent

Analyze MySQL queries with negligible overhead
Go
35
star
83

performance-quality-models

Personalizing Performance model repository
Jupyter Notebook
31
star
84

data-integration-library

The Data Integration Library project provides a library of generic components based on a multi-stage architecture for data ingress and egress.
Java
28
star
85

Iris-message-processor

Iris-message-processor is a fully distributed Go application meant to replace the sender functionality of Iris and provide reliable, scalable, and extensible incident and out of band message processing and sending.
Go
27
star
86

smart-arg

Smart Arguments Suite (smart-arg) is a slim and handy python lib that helps one work safely and conveniently with command line arguments.
Python
23
star
87

linkedin-calcite

LinkedIn's version of Apache Calcite
Java
22
star
88

atscppapi

This library provides wrappers around the existing Apache Traffic Server API which will vastly simplify the process of writing Apache Traffic Server plugins.
C++
20
star
89

forthic

Python
18
star
90

high-school-trainee

LinkedIn Women in Tech High School Trainee Program
Python
18
star
91

play-parseq

Play-ParSeq is a Play module which seamlessly integrates ParSeq with Play Framework
Scala
17
star
92

icon-magic

Automated icon build system for iOS, Android and Web
TypeScript
17
star
93

QuantEase

QuantEase, a layer-wise quantization framework, frames the problem as discrete-structured non-convex optimization. Our work leverages Coordinate Descent techniques, offering high-quality solutions without the need for matrix inversion or decomposition.
Python
17
star
94

kafka-remote-storage-azure

Java
13
star
95

play-restli

A library that simplifies building restli services on top of the play server.
Java
12
star
96

spark-inequality-impact

Scala
12
star
97

Li-Airflow-Backfill-Plugin

Li-Airflow-Backfill-Plugin is a plugin to work with Apache Airflow to provide data backfill feature, ie. to rerun pipelines for a certain date range.
Python
10
star
98

AlerTiger

Jupyter Notebook
9
star
99

diderot

A fast and flexible implementation of the xDS protocol
Go
6
star
100

gobblin-elr

This is a read-only mirror of apache/gobblin
Java
5
star