MCPcopy Index your code
hub / github.com/apache/celeborn

github.com/apache/celeborn @v0.6.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.6.3 ↗ · + Follow
6,711 symbols 22,031 edges 731 files 1,049 documented · 16%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Apache Celeborn

Celeborn CI
Celeborn (/ˈkeləbɔ:n/) is dedicated to improving the efficiency and elasticity of different map-reduce engines and provides an elastic, high-efficient management service for intermediate data including shuffle data, spilled data, result data, etc. Currently, Celeborn is focusing on shuffle data.

Internals

Architecture

Celeborn architecture Celeborn has three primary components: Master, Worker, and Client. Master manages all resources and syncs shared states based on Raft. Worker processes read-write requests and merges data for each reducer. LifecycleManager maintains metadata of each shuffle and runs within the Spark driver.

Feature

  1. Disaggregate Computing and storage.
  2. Push-based shuffle write and merged shuffle read.
  3. High availability and high fault tolerance.

Shuffle Process

Celeborn shuffle 1. Mappers lazily ask LifecycleManager to registerShuffle. 2. LifecycleManager requests slots from Master. 3. Workers reserve slots and create corresponding files. 4. Mappers get worker locations from LifecycleManager. 5. Mappers push data to specified workers. 6. Workers merge and replicate data to its peer. 7. Workers flush to disk periodically. 8. Mapper tasks accomplish and trigger MapperEnd event. 9. When all mapper tasks are complete, workers commit files. 10. Reducers ask for file locations. 11. Reducers read shuffle data.

Load Balance

Load Balance

We introduce slots to achieve load balance. We will equally distribute partitions on every Celeborn worker by tracking slot usage. The Slot is a logical concept in Celeborn Worker that represents how many partitions can be allocated to each Celeborn Worker. Celeborn Worker's slot count is decided by total usable disk size / average shuffle file size. Celeborn worker's slot count decreases when a partition is allocated and increments when a partition is freed.

Build

  1. Celeborn supports Spark 2.4/3.0/3.1/3.2/3.3/3.4/3.5/4.0, Flink 1.16/1.17/1.18/1.19/1.20 and Hadoop MapReduce 2/3.
  2. Celeborn tested under Scala 2.11/2.12/2.13 and Java 8/11/17 environment.

Build Celeborn via make-distribution.sh:

./build/make-distribution.sh -Pspark-2.4/-Pspark-3.0/-Pspark-3.1/-Pspark-3.2/-Pspark-3.3/-Pspark-3.4/-Pspark-3.5/-Pspark-4.0/-Pflink-1.16/-Pflink-1.17/-Pflink-1.18/-Pflink-1.19/-Pflink-1.20/-Pflink-2.0/-Pmr

Package apache-celeborn-${project.version}-bin.tgz will be generated.

NOTE: The following table indicates the compatibility of Celeborn Spark and Flink clients with different versions of Spark and Flink for various Java and Scala versions.

Java 8/Scala 2.11 Java 8/Scala 2.12 Java 11/Scala 2.12 Java 17/Scala 2.12 Java 8/Scala 2.13 Java 11/Scala 2.13 Java 17/Scala 2.13
Spark 2.4
Spark 3.0
Spark 3.1
Spark 3.2
Spark 3.3
Spark 3.4
Spark 3.5
Spark 4.0
Flink 1.16
Flink 1.17
Flink 1.18
Flink 1.19
Flink 1.20
Flink 2.0

To compile the client for Spark 2.4 with Scala 2.12, please use the following command:

  • Scala 2.12.8/2.12.9/2.12.10
./build/make-distribution.sh -DskipTests -Pspark-2.4 -Dscala.version=${scala.version} -Dscala.binary.version=2.12 -Dmaven.plugin.scala.version=3.2.2 -Dmaven.plugin.silencer.version=1.6.0
  • Scala 2.12.13-2.12.18
./build/make-distribution.sh -DskipTests -Pspark-2.4 -Dscala.version=${scala.version} -Dscala.binary.version=2.12

To compile for Spark 3.5 with Java21, please use the following command

./build/make-distribution.sh -Pspark-3.5 -Pjdk-21
./build/make-distribution.sh --sbt-enabled -Pspark-3.5 -Pjdk-21

To compile for Spark 4.0 with Java21, please use the following command

./build/make-distribution.sh -Pspark-4.0 -Pjdk-21
./build/make-distribution.sh --sbt-enabled -Pspark-4.0 -Pjdk-21

NOTE: Celeborn supports automatic builds on linux aarch64 platform via aarch64 profile. aarch64 profile requires glibc version 3.4.21. There is potential problematic frame C [libc.so.6+0x8412a] for other glibc version like 2.x etc.

To build Celeborn with AWS S3 support MPU, please use the following command

./build/make-distribution.sh --sbt-enabled -Pspark-3.4 -Pjdk-8 -Paws

To build Celeborn with Aliyun OSS support MPU, please use the following command

./build/make-distribution.sh --sbt-enabled -Pspark-3.4 -Pjdk-8 -Paliyun

Package Details

Build procedure will create a compressed package.

General package layout:

    ├── RELEASE                         
    ├── bin                             
    ├── conf                            
    ├── jars           // common jars for master and worker                 
    ├── master-jars                     
    ├── worker-jars                  
    ├── cli-jars     
    ├── spark          // Spark client jars if spark profiles are activated
    ├── flink          // Flink client jars if flink profiles are activated
    ├── mr             // MapReduce client jars if mr profile is activated
    └── sbin

Compatibility

Celeborn server is compatible with all clients inside various engines. However, Celeborn clients must be consistent with the version of the specified engine. For example, if you are running Spark 2.4, you must compile Celeborn client with -Pspark-2.4; if you are running Spark 3.2, you must compile Celeborn client with -Pspark-3.2; if you are running flink 1.16, you must compile Celeborn client with -Pflink-1.16.

Usage

Celeborn cluster composes of Master and Worker nodes, the Master supports both single and HA mode(Raft-based) deployments.

Deploy Celeborn

Deploy on host

  1. Unzip the tarball to $CELEBORN_HOME.
  2. Modify environment variables in $CELEBORN_HOME/conf/celeborn-env.sh.

EXAMPLE:

#!/usr/bin/env bash
CELEBORN_MASTER_MEMORY=4g
CELEBORN_WORKER_MEMORY=2g
CELEBORN_WORKER_OFFHEAP_MEMORY=4g
  1. Modify configurations in $CELEBORN_HOME/conf/celeborn-defaults.conf.

EXAMPLE: single master cluster

# used by client and worker to connect to master
celeborn.master.endpoints clb-master:9097

# used by master to bootstrap
celeborn.master.host clb-master
celeborn.master.port 9097

celeborn.metrics.enabled true
celeborn.worker.flusher.buffer.size 256k

# If Celeborn workers have local disks and HDFS. Following configs should be added.
# If Celeborn workers have local disks, use following config.
# Disk type is HDD by default.
celeborn.worker.storage.dirs /mnt/disk1:disktype=SSD,/mnt/disk2:disktype=SSD

# If Celeborn workers don't have local disks. You can use HDFS.
# Do not set `celeborn.worker.storage.dirs` and use following configs.
celeborn.storage.availableTypes HDFS
celeborn.worker.sortPartition.threads 64
celeborn.worker.commitFiles.timeout 240s
celeborn.worker.commitFiles.threads 128
celeborn.master.slot.assign.policy roundrobin
celeborn.rpc.askTimeout 240s
celeborn.worker.flusher.hdfs.buffer.size 4m
celeborn.storage.hdfs.dir hdfs://<namenode>/celeborn
celeborn.worker.replicate.fastFail.duration 240s
# Either principal/keytab or valid TGT cache is required to access kerberized HDFS
celeborn.storage.hdfs.kerberos.principal user@REALM
celeborn.storage.hdfs.kerberos.keytab /path/to/user.keytab

# If your hosts have disk raid or use lvm, set `celeborn.worker.monitor.disk.enabled` to false
celeborn.worker.monitor.disk.enabled false

EXAMPLE: HA cluster

# used by client and worker to connect to master
celeborn.master.endpoints clb-1:9097,clb-2:9097,clb-3:9097

# used by master nodes to bootstrap, every node should know the topology of whole cluster, for each node,
# `celeborn.master.ha.node.id` should be unique, and `celeborn.master.ha.node.<id>.host` is required.
celeborn.master.ha.enabled true
celeborn.master.ha.node.1.host clb-1
celeborn.master.ha.node.1.port 9097
celeborn.master.ha.node.1.ratis.port 9872
celeborn.master.ha.node.2.host clb-2
celeborn.master.ha.node.2.port 9097
celeborn.master.ha.node.2.ratis.port 9872
celeborn.master.ha.node.3.host clb-3
celeborn.master.ha.node.3.port 9097
celeborn.master.ha.node.3.ratis.port 9872
celeborn.master.ha.ratis.raft.server.storage.dir /mnt/disk1/celeborn_ratis/

celeborn.metrics.enabled true
# If you want to use HDFS as shuffle storage, make sure that flush buffer size is at least 4MB or larger.
celeborn.worker.flusher.buffer.size 256k

# If Celeborn workers have local disks and HDFS. Following configs should be added.
# Celeborn will use local disks until local disk become unavailable to gain the best performance.
# Increase Celeborn's off-heap memory if Celeborn write to HDFS.
# If Celeborn workers have local disks, use following config.
# Disk type is HDD by default.
celeborn.worker.storage.dirs /mnt/disk1:disktype=SSD,/mnt/disk2:disktype=SSD

# If Celeborn workers don't have local disks. You can use HDFS.
# Do not set `celeborn.worker.storage.dirs` and use following configs.
celeborn.storage.availableTypes HDFS
celeborn.worker.sortPartition.threads 64
celeborn.worker.commitFiles.timeout 240s
celeborn.worker.commitFiles.threads 128
celeborn.master.slot.assign.policy roundrobin
celeborn.rpc.askTimeout 240s
celeborn.worker.flusher.hdfs.buffer.size 4m
celeborn.storage.hdfs.dir hdfs://<namenode>/celeborn
celeborn.worker.replicate.fastFail.duration 240s

# If your hosts have disk raid or use lvm, set `celeborn.worker.monitor.disk.enabled` to false
celeborn.worker.monitor.disk.enabled false

Flink engine related configurations:

# If you are using Celeborn for flink, these settings will be needed.
celeborn.worker.directMemoryRatioForReadBuffer 0.4
celeborn.worker.directMemoryRatioToResume 0.5
# These setting will affect performance. 
# If there is enough off-heap memory, you can try to increase read buffers.
# Read buffer max memory usage for a data partition is `taskmanager.memory.segment-size * readBuffersMax`
celeborn.worker.partition.initial.readBuffersMin 512
celeborn.worker.partition.initial.readBuffersMax 1024
celeborn.worker.readBuffer.allocationWait 10ms
  1. Copy Celeborn and configurations to all nodes.
  2. Start all services. If you install Celeborn distribution in the same path on every node and your cluster can perform SSH login then you can fill $CELEBORN_HOME/conf/hosts and use $CELEBORN_HOME/sbin/start-all.sh to start all services. If the installation paths are not identical, you will need to start the service manually.
    Start Celeborn master
    $CELEBORN_HOME/sbin/start-master.sh
    Start Celeborn worker
    $CELEBORN_HOME/sbin/start-worker.sh
  3. If Celeborn starts success, the output of the Master's log should be like this: ``` 22/10/08 19:29:11,805 INFO [main] Dispatcher: Dispatcher numThreads: 64 22/10/08 19:29:11,875 INFO [main] TransportClientFactory: mode NIO threads 64 22/10/08 19:29:12,057 INFO [main] Utils: Successfully started service 'Master' on port 9097. 22/10/08 19:29:12,113 INFO [main] Master: Metrics system enabled. 22/10/08 19:29:12,125 INFO [main] HttpServer: master: HttpServer started on port 9098. 22/10/08 19:29:12,126 INFO [main] Master: Master started. 22/10/08 19:29:57,842 INFO [dispatcher-event-loop-19] Master: Registered worker Host: 192.168.15.140 RpcPort: 37359 PushPort: 38303 FetchPort: 37569 ReplicatePort: 37093 SlotsUsed: 0() LastHeartbeat: 0 Disks: {/mnt/disk1=DiskInfo(maxSlots: 6679, committed shuffles 0, running applications 0, shuffleAllocations: Map(), mountPoint: /mnt/disk1, usableSpace: 448284381184, avgFlushTim

Extension points exported contracts — how you extend this code

ShuffleFallbackPolicy (Interface)
The shuffle fallback policy determines whether fallback to vanilla Flink built-in shuffle implementation. [10 implementers]
client-flink/common/src/main/java/org/apache/celeborn/plugin/flink/fallback/ShuffleFallbackPolicy.java
TransportClientBootstrap (Interface)
A bootstrap which is executed on a TransportClient before it is returned to the user. This enables an initial exchange o [6 …
common/src/main/java/org/apache/celeborn/common/network/client/TransportClientBootstrap.java
ShuffleFallbackPolicy (Interface)
The shuffle fallback policy determines whether fallback to vanilla Spark built-in shuffle implementation. [11 implementers]
client-spark/common/src/main/java/org/apache/spark/shuffle/celeborn/ShuffleFallbackPolicy.java
PartitionReader (Interface)
(no doc) [6 implementers]
client/src/main/java/org/apache/celeborn/client/read/PartitionReader.java
ConfigStore (Interface)
Config store defines store backend for dynamic config service including short name and config service implementation. [4 …
service/src/main/java/org/apache/celeborn/server/common/service/config/ConfigStore.java
DB (Interface)
Note: code copied from Apache Spark. [4 implementers]
worker/src/main/java/org/apache/celeborn/service/deploy/worker/shuffledb/DB.java
Authentication (Interface)
(no doc) [9 implementers]
openapi/openapi-client/src/main/java/org/apache/celeborn/rest/v1/worker/invoker/auth/Authentication.java
IMetadataHandler (Interface)
(no doc) [3 implementers]
master/src/main/java/org/apache/celeborn/service/deploy/master/clustermeta/IMetadataHandler.java

Core symbols most depended-on inside this repo

append
called by 776
client-flink/common/src/main/java/org/apache/celeborn/plugin/flink/buffer/DataBuffer.java
get
called by 710
client-flink/common/src/main/java/org/apache/celeborn/plugin/flink/client/FlinkShuffleClientImpl.java
put
called by 471
worker/src/main/java/org/apache/celeborn/service/deploy/worker/shuffledb/DB.java
add
called by 412
worker/src/main/java/org/apache/celeborn/service/deploy/worker/memory/BufferQueue.java
size
called by 335
cpp/celeborn/memory/ByteBuffer.h
get
called by 322
worker/src/main/java/org/apache/celeborn/service/deploy/worker/shuffledb/DB.java
set
called by 228
common/src/main/java/org/apache/celeborn/reflect/DynFields.java
getLogger
called by 166
openapi/openapi-client/src/main/java/org/apache/celeborn/rest/v1/worker/LoggerApi.java

Shape

Method 5,701
Class 762
Function 145
Interface 66
Enum 37

Languages

Java93%
C++6%
TypeScript1%
Python1%

Modules by API surface

openapi/openapi-client/src/main/java/org/apache/celeborn/rest/v1/model/WorkerInfoResponse.java59 symbols
client/src/main/java/org/apache/celeborn/client/ShuffleClientImpl.java57 symbols
worker/src/main/java/org/apache/celeborn/service/deploy/worker/memory/MemoryManager.java56 symbols
openapi/openapi-client/src/main/java/org/apache/celeborn/rest/v1/worker/invoker/ApiClient.java56 symbols
openapi/openapi-client/src/main/java/org/apache/celeborn/rest/v1/master/invoker/ApiClient.java56 symbols
openapi/openapi-client/src/main/java/org/apache/celeborn/rest/v1/model/WorkerData.java53 symbols
openapi/openapi-client/src/main/java/org/apache/celeborn/rest/v1/model/ThreadStack.java49 symbols
worker/src/main/java/org/apache/celeborn/service/deploy/worker/storage/PartitionFilesSorter.java41 symbols
common/src/main/java/org/apache/celeborn/reflect/DynFields.java40 symbols
common/src/main/java/org/apache/celeborn/common/network/util/TransportConf.java39 symbols
client-flink/common/src/main/java/org/apache/celeborn/plugin/flink/buffer/BufferPacker.java38 symbols
common/src/main/java/org/apache/celeborn/common/protocol/PartitionLocation.java37 symbols

For agents

$ claude mcp add celeborn \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact