Apache Celeborn Documentation

repository·main·Indexed 21 days ago

https://github.com/apache/celeborn

Apache Celeborn is a high-performance, elastic service for managing intermediate shuffle, spilled, and result data for map-reduce engines like Spark, Flink, and MapReduce. It decouples computing from storage using a Master-Worker architecture and a push-based shuffle write mechanism. The documentation covers installation, Kubernetes deployment via Helm, integration with Big Data compute engines, and building from source.

Tokens
104.9K
Snippets
181
Records
317
Agent score
76%

What's inside Apache Celeborn

  1. What is Apache Celeborn?

    main
    Apache Celeborn is a service designed to improve the efficiency and elasticity of map-reduce engines by providing an elastic, high-efficiency management service for intermediate data, such as shuffle data, spilled data, and result data. It focuses primarily on shuffle data management through disaggregated computing and storage, push-based shuffle writes, and merged shuffle reads.
  2. Monitor the Celeborn cluster

    main

    Celeborn provides two primary methods for monitoring the cluster state and performance:

    1. Prometheus metrics: For time-series data collection and alerting.
    2. REST API: For programmatic access to cluster information and status.
  3. Handle Fetch failures and retries

    main

    When fetching chunks from a data file, the ShuffleClient manages failures through a retry mechanism:

    • Retry Limit: The ShuffleClient has a maximum number of retries per replica (defaults to 3).
    • Replica Switching: If a fetch chunk fails, the ShuffleClient attempts to try another replica. If replication is disabled, it retries the same replica.
    • Failure State: If the maximum number of retries is exceeded, the ShuffleClient stops retrying and throws an Exception.
  4. Disk health and capacity management in Workers

    main

    Celeborn Workers perform periodic checks on disk health and usage to ensure stability:

    • Health Checks: If a disk health check fails, the Worker isolates that disk and will not allocate slots on it until it returns to a healthy state.
    • Capacity Threshold: If usable space falls below a specific threshold (defaults to 5GiB), the Worker will stop allocating slots on that disk.
    • Preventing Overflow: To prevent exceeding available space, the Worker triggers a HARD_SPLIT for all PartitionLocations on the disk to prevent further file size growth.
  5. Understand configuration precedence and levels

    main

    Dynamic configurations are applied at different levels. When multiple levels define the same key, the following order of precedence applies (from highest to lowest):

    1. TENANT_USER: Specific to a tenantId and a username. Overrides TENANT and SYSTEM levels.
    2. TENANT: Specific to a tenantId. Overrides SYSTEM level.
    3. SYSTEM: Global system-wide configuration. Overrides static CelebornConf.
    4. Static Configuration: The base configuration defined in CelebornConf.
  6. How the Celeborn shuffle process works

    main

    The shuffle lifecycle follows these steps:

    1. Mappers lazily ask the LifecycleManager to registerShuffle.
    2. LifecycleManager requests slots from the Master.
    3. Workers reserve slots and create corresponding files.
    4. Mappers retrieve worker locations from the LifecycleManager.
    5. Mappers push data to the specified workers.
    6. Workers merge and replicate data to their peers.
    7. Workers periodically flush data to disk.
    8. Mapper tasks complete and trigger a MapperEnd event.
    9. Once all mapper tasks are complete, workers commit the files.
    10. Reducers request file locations.
    11. Reducers read the shuffle data.
  7. How Celeborn achieves load balancing via Slots

    main

    Celeborn uses a logical concept called a Slot to achieve load balancing across workers. A Slot represents the capacity of a Celeborn Worker to hold partitions.

    • Slot Count Calculation: The number of slots per worker is determined by total usable disk size / average shuffle file size.
    • Lifecycle: A worker's slot count decreases when a partition is allocated and increments when a partition is freed.
  8. Use TagsQL for advanced worker selection

    main

    TagsQL provides enhanced flexibility for selecting workers based on key-value pairs. To use it, set celeborn.tags.useTagsQL to true in the Master configuration.

    Syntax Rules:

    • Match single value: key:value
    • Negate single value: key:!value
    • Match list of values: key:{value1,value2}
    • Negate list of values: key:!{value1,value2}

    Note: TagsQL only supports tags where key-value pairs are separated by an equal sign (=) in the underlying data.

    Example: env:production region:{us-east,us-west} env:!sandbox selects workers where env is production, region is either us-east or us-west, and env is NOT sandbox.

    celeborn.tags.useTagsQL=true
    # Example expression:
    env:production region:{us-east,us-west} env:!sandbox
  9. Understand the roles of the Celeborn Master

    main

    The Celeborn Master is the central coordinator of the cluster. Its primary responsibilities include:

    • Cluster Status Management: Tracking the health and availability of all Worker nodes.
    • Shuffle Lifecycle Management: Maintaining active shuffles and cleaning up resources when applications fail.
    • High Availability (HA): Ensuring the Master component remains resilient using the Raft consensus protocol.
    • Slot Allocation: Distributing shuffle partition locations to available disks across the cluster using load-balancing strategies.
  10. Ensure Celeborn client and engine version compatibility

    main

    While the Celeborn server is compatible with various engine clients, the Celeborn client must match the version of the engine you are running.

    For example, if you are using Spark 3.2, you must compile the Celeborn client using the -Pspark-3.2 flag.

  11. How Congestion Control works in Celeborn Workers

    main

    Congestion Control is an optional mechanism used to slow down the data push rate from ShuffleClients when memory pressure is high. It aims to achieve fairness by suppressing users who consume disproportionately high resources.

    Mechanism

    • Identification: The Worker uses a UserIdentifier to track the number of bytes pushed by each user in the last time window.
    • Trigger: When used direct memory exceeds the High Watermark, the Worker identifies "top users" (those who occupied more resources than the average) and sends them a Congestion Control message.
    • Client Behavior: Upon receiving a Congestion Control message, the ShuffleClient behaves similarly to TCP Congestion Control:
      • Slow Start: An initial phase with a low push rate that increases rapidly.
      • Congestion Avoidance: A phase where the push rate increases slowly after reaching a threshold.
      • Recovery: If a Congestion Control message is received, the client reverts from Congestion Avoidance back to the Slow Start phase.

    Configuration

    Congestion Control can be enabled and tuned using the celeborn.worker.congestionControl.* configuration prefix.

  12. Use Async Push to prevent blocking compute engines

    main

    Celeborn supports asynchronous pushing via the DataPusher component to ensure that the compute engine's execution is not blocked by shuffle I/O.

    Workflow:

    1. The compute engine calls DataPusher#addTask.
    2. A PushTask containing the data is created and added to a non-blocking queue.
    3. DataPusher continuously polls the queue and invokes ShuffleClient#pushData to perform the actual transfer.