Skip to content

[ClusterPipeline] ExecutorService/thread is created and destroyed too frequently in ClusterPipeline #4141

@xrayw

Description

@xrayw

Title

Allow externally managed ExecutorService for multi-node pipeline operations

Description

Problem:

Multi-node pipelines create a new ExecutorService on every sync() call (line 93), causing significant overhead in high-throughput applications:

@Override
public final void sync() {
  // ...
  if (multiNode) {
    executorService = Executors.newFixedThreadPool(MULTI_NODE_PIPELINE_SYNC_WORKERS);
    executor = executorService;
  }
  // ...
}

Thread creation is expensive:

  • Allocates large memory blocks for thread stacks
  • Requires system calls to register native threads
  • Adds latency to each pipeline operation

In high-throughput scenarios (e.g., 100k ops/sec), this overhead can consume 40% of CPU.

Proposed Solution:

Allow users to provide an externally managed ExecutorService that can be reused across pipeline operations

Benefits:

  • Eliminates thread creation overhead
  • Allows tuning executor to specific workload patterns
  • Maintains backward compatibility with current behavior as default

Related:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions