Skip to content

Conversation

@jojochuang
Copy link
Contributor

What changes were proposed in this pull request?

HDDS-13579. [Docs] Explain how Ratis write pipelines are calculated

Please describe your PR in detail:

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-13579

How was this patch tested?

Doc only.

@szetszwo
Copy link
Contributor

szetszwo commented Jan 3, 2026

@jojochuang , thanks for working on this!

Could you limit the line length to 120 characters like the code? It is easier to comment on it.

Discovered and corrected the documentation for how the number of
EC pipelines is calculated. The previous analysis was incorrect.

- `ErasureCoding.md` is updated to describe the two new properties
  `ozone.scm.ec.pipeline.minimum` and
  `ozone.scm.ec.pipeline.per.volume.factor` and the `max()` logic
  used to determine the target number of pipelines.

- `ProductionDeployment.md` is updated to reference the correct
  and existing configuration property for tuning EC pipelines.

Change-Id: I393dc60d8745da2b2bb7899530665a108956446d
Change-Id: I0ec667c21155436eb6a0654782b43b48636f75d5
@jojochuang
Copy link
Contributor Author

thanks for review. updated.

@adoroszlai adoroszlai added the documentation Improvements or additions to documentation label Jan 5, 2026
Copy link
Contributor

@ashishkumar50 ashishkumar50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jojochuang Thanks for writing this up.

recommended, as it allows the cluster to scale pipeline capacity naturally with its resources. You can use the
global limit (`ozone.scm.ratis.pipeline.limit`) as a safety cap if needed. A good starting value for
`ozone.scm.pipeline.per.metadata.disk` is **2**. Monitor the `NumOpenPipelines` metric in SCM to see if the
actual number of pipelines aligns with your configured targets.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think NumOpenPipelines metrics doesn't exist. We can either use admin command to see number of open pipelines or may use recon as well to see the open pipelines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify, the SCM web UI has a section Pipeline Statistics, and it pulls the metrics from:

{
"name": "Hadoop:service=SCMPipelineManager,name=SCMPipelineManagerInfo",
"modelerType": "org.apache.hadoop.hdds.scm.pipeline.PipelineManagerImpl",
"PipelineInfo": [
  {
    "key": "CLOSED",
    "value": 0
  },
  {
    "key": "ALLOCATED",
    "value": 0
  },
  {
    "key": "OPEN",
    "value": 1
  },
  {
    "key": "DORMANT",
    "value": 0
  }
  ]
},

Change-Id: I2537905761cf45d23cdb3701b2f0c94e7ff2485a
Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jojochuang , thanks for working on this!

The code is quite distributed so it is not easy to understand the exact calculation. Please see the comments inlined (not yet reviewed the example).


### Calculating Ratis Pipeline Limits

The target number of open, FACTOR_THREE Ratis pipelines is controlled by three properties that define the maximum
Copy link
Contributor

@szetszwo szetszwo Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... FACTOR_THREE ...

Let's use ReplicationFactor.THREE, which is a client API.

... three properties ... that define the maximum

three configuration properties ... that limit the

### Calculating Ratis Pipeline Limits

The target number of open, FACTOR_THREE Ratis pipelines is controlled by three properties that define the maximum
number of pipelines in the cluster at a cluster-wide level, datanode level, and metadata disk level, respectively.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... a cluster-wide level, datanode level, and metadata disk level, respectively.

a cluster-wide level and a datanode level.

1. **Cluster-wide Limit (`ozone.scm.ratis.pipeline.limit`)**
* **Description**: An absolute, global limit for the total number of open, FACTOR_THREE Ratis pipelines
across the entire cluster. This acts as a final cap on the total number of pipelines.
* **Default Value**: `0` (which means no global limit is enforced by default).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... no global limit is enforced by default).

no global limit by default).

2. **Datanode-level Fixed Limit (`ozone.scm.datanode.pipeline.limit`)**
* **Description**: When set to a positive number, this property defines a fixed maximum number of pipelines for
every datanode. This is one of two ways to calculate a cluster-wide target.
* **Default Value**: `2`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tricky since we have a bug; see HDDS-14369.

* **Calculation**: If this is set, the target is `(<this value> * <number of healthy datanodes>) / 3`.

3. **Datanode-level Dynamic Limit (`ozone.scm.pipeline.per.metadata.disk`)**
* **Description**: This property is used only when `ozone.scm.datanode.pipeline.limit` is explicitly set to `0`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... This property is used ... is explicitly set to 0.

This property takes effect ... is not set to a positive number.


The target number of open, FACTOR_THREE Ratis pipelines is controlled by three properties that define the maximum
number of pipelines in the cluster at a cluster-wide level, datanode level, and metadata disk level, respectively.
SCM will create pipelines until the most restrictive limit is met.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace this sentence with

  • "The number of pipelines created by SCM is restricted by these limits."

SCM will create pipelines until the most restrictive limit is met.

1. **Cluster-wide Limit (`ozone.scm.ratis.pipeline.limit`)**
* **Description**: An absolute, global limit for the total number of open, FACTOR_THREE Ratis pipelines
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove FACTOR_THREE since the code actually includes ReplicationFactor.ONE pipeline; see

if (pipelineNumberLimit > 0) {
int factorOnePipelineCount = pipelineStateManager
.getPipelines(RatisReplicationConfig.getInstance(ReplicationFactor.ONE)).size();
int allowedOpenPipelines = pipelineNumberLimit - factorOnePipelineCount;
return openPipelines >= allowedOpenPipelines;
}

* **Description**: When set to a positive number, this property defines a fixed maximum number of pipelines for
every datanode. This is one of two ways to calculate a cluster-wide target.
* **Default Value**: `2`
* **Calculation**: If this is set, the target is `(<this value> * <number of healthy datanodes>) / 3`.
Copy link
Contributor

@szetszwo szetszwo Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    *   **Cluster-wide Limit Calculation**: If this property is set,
        the number of pipelines in the cluster is in addition limited by
        `(<this value> * <number of healthy datanodes>) / 3`.

(revised)

Comment on lines +93 to +95
* **Calculation**: The limit for each datanode is
`(<this value> * <number of metadata disks on that datanode>)`.
The total cluster-wide target is the sum of all individual datanode limits, divided by 3.
Copy link
Contributor

@szetszwo szetszwo Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this section since it seems not true (or I cannot find the code enforcing it). I do see that the value is used for filtering datanodes.

private boolean exceedPipelineNumberLimit(RatisReplicationConfig replicationConfig) {
// Apply limits only for replication factor THREE
if (replicationConfig.getReplicationFactor() != ReplicationFactor.THREE) {
return false;
}
PipelineStateManager pipelineStateManager = getPipelineStateManager();
int totalActivePipelines = pipelineStateManager.getPipelines(replicationConfig).size();
int closedPipelines = pipelineStateManager.getPipelines(replicationConfig, PipelineState.CLOSED).size();
int openPipelines = totalActivePipelines - closedPipelines;
// Check per-datanode pipeline limit
if (maxPipelinePerDatanode > 0) {
int healthyNodeCount = getNodeManager()
.getNodeCount(NodeStatus.inServiceHealthy());
int allowedOpenPipelines = (maxPipelinePerDatanode * healthyNodeCount)
/ replicationConfig.getRequiredNodes();
return openPipelines >= allowedOpenPipelines;
}
// Check global pipeline limit
if (pipelineNumberLimit > 0) {
int factorOnePipelineCount = pipelineStateManager
.getPipelines(RatisReplicationConfig.getInstance(ReplicationFactor.ONE)).size();
int allowedOpenPipelines = pipelineNumberLimit - factorOnePipelineCount;
return openPipelines >= allowedOpenPipelines;
}
// No limits are set
return false;
}


2. **Datanode-level Fixed Limit (`ozone.scm.datanode.pipeline.limit`)**
* **Description**: When set to a positive number, this property defines a fixed maximum number of pipelines for
every datanode. This is one of two ways to calculate a cluster-wide target.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the sentence "This is one of two ways to calculate a cluster-wide target." since the Dynamic Limit
is not used in RatisPipelineProvider.exceedPipelineNumberLimit(..).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants