# LoadShedQueueFlowController Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.streams.loadshedqueueflowcontroller/)

## CreateAsPercentOfLoadSheddingLimit(LoadSheddingOptions, IEnvironmentStatisticsProvider, int) {#createaspercentofloadsheddinglimit-orleans-configuration-loadsheddingoptions-orl-9f5adabc}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.streams.loadshedqueueflowcontroller/methods/createaspercentofloadsheddinglimit-orleans-configuration-loadsheddingoptions-orl-9f5adabc/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/LoadShedQueueFlowController.cs#L29-L31)

```csharp
public static IQueueFlowController CreateAsPercentOfLoadSheddingLimit(LoadSheddingOptions options, IEnvironmentStatisticsProvider environmentStatisticsProvider, int percentOfSiloSheddingLimit = 95)
```

Creates a flow controller triggered when the CPU reaches a percentage of the cluster load shedding limit. This is intended to reduce queue read rate prior to causing the silo to shed load. Note: Triggered only when load shedding is enabled.

### Parameters

- `options` (`LoadSheddingOptions`): The silo statistics options.
- `environmentStatisticsProvider` (`IEnvironmentStatisticsProvider`): The silo environment statistics.
- `percentOfSiloSheddingLimit` (`int`): Percentage of load shed limit which triggers a reduction of queue read rate.

### Returns

The flow controller.

## CreateAsPercentageOfCPU(int, LoadSheddingOptions, IEnvironmentStatisticsProvider) {#createaspercentageofcpu-int-orleans-configuration-loadsheddingoptions-orleans-st-a20610e4}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.streams.loadshedqueueflowcontroller/methods/createaspercentageofcpu-int-orleans-configuration-loadsheddingoptions-orleans-st-a20610e4/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/LoadShedQueueFlowController.cs#L44-L45)

```csharp
public static IQueueFlowController CreateAsPercentageOfCPU(int loadSheddingLimit, LoadSheddingOptions options, IEnvironmentStatisticsProvider environmentStatisticsProvider)
```

Creates a flow controller triggered when the CPU reaches the specified limit. Note: Triggered only when load shedding is enabled.

### Parameters

- `loadSheddingLimit` (`int`): Percentage of CPU which triggers queue read rate reduction
- `options` (`LoadSheddingOptions`): The silo statistics options.
- `environmentStatisticsProvider` (`IEnvironmentStatisticsProvider`): The silo environment statistics.

### Returns

The flow controller.

## GetMaxAddCount {#getmaxaddcount-d2365b19}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.streams.loadshedqueueflowcontroller/methods/getmaxaddcount-d2365b19/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/LoadShedQueueFlowController.cs#L59)

```csharp
public int GetMaxAddCount()
```

Gets the maximum number of items that can be added.

### Returns

The maximum number of items that can be added.
