你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

CosmosBulkExecutionOptions 类

  • java.lang.Object
    • com.azure.cosmos.models.CosmosBulkExecutionOptions

public final class CosmosBulkExecutionOptions

封装可为批量执行中使用的操作指定的选项。 可以在处理批量操作时传递它。

构造函数摘要

构造函数 说明
CosmosBulkExecutionOptions()

构造函数

CosmosBulkExecutionOptions(CosmosBulkExecutionThresholdsState thresholdsState)

构造函数

方法摘要

修饰符和类型 方法和描述
List<String> getExcludedRegions()

获取要为请求/重试排除的区域的列表。

int getInitialMicroBatchSize()

获取将发送到后端的微批的初始大小。

int getMaxMicroBatchConcurrency()

对分区键范围执行请求的最大并发性。

CosmosBulkExecutionThresholdsState getThresholdsState()

返回将来可传递给其他 Cosmos批量执行选项的阈值状态

String getThroughputControlGroupName()

获取吞吐量控制组名称。

CosmosBulkExecutionOptions setExcludedRegions(List<String> excludeRegions)

要为请求/重试排除的区域列表。

CosmosBulkExecutionOptions setInitialMicroBatchSize(int initialMicroBatchSize)

设置将发送到后端的微批的初始大小。

CosmosBulkExecutionOptions setMaxMicroBatchConcurrency(int maxMicroBatchConcurrency)

为分区键范围设置执行请求的最大并发性。

CosmosBulkExecutionOptions setThroughputControlGroupName(String throughputControlGroupName)

设置吞吐量控制组名称。

方法继承自 java.lang.Object

构造函数详细信息

CosmosBulkExecutionOptions

public CosmosBulkExecutionOptions()

构造函数

CosmosBulkExecutionOptions

public CosmosBulkExecutionOptions(CosmosBulkExecutionThresholdsState thresholdsState)

构造函数

Parameters:

thresholdsState - 阈值

方法详细信息

getExcludedRegions

public List getExcludedRegions()

获取要为请求/重试排除的区域的列表。 这些区域从首选区域列表中排除。

Returns:

排除区域的列表

getInitialMicroBatchSize

public int getInitialMicroBatchSize()

获取将发送到后端的微批的初始大小。 微批的大小将根据限制速率动态调整。 默认值为 100 - 因此,它从相对较大的微批开始,当限制速率过高时,它将减小批大小。 如果在动态减小初始批大小之前出现短时间限制峰值,导致对其他工作负荷产生副作用,则可以减小初始微批大小(例如设置为 1),此时会从小微批开始,然后随时间推移增加批大小。

Returns:

初始微批大小

getMaxMicroBatchConcurrency

public int getMaxMicroBatchConcurrency()

对分区键范围执行请求的最大并发性。 默认情况下,maxMicroBatchConcurrency 为 1。

Returns:

max 微批并发

getThresholdsState

public CosmosBulkExecutionThresholdsState getThresholdsState()

返回将来可传递给其他 CosmosBulkExecutionOptions 的阈值状态

Returns:

阈值

getThroughputControlGroupName

public String getThroughputControlGroupName()

获取吞吐量控制组名称。

Returns:

吞吐量控制组名称。

setExcludedRegions

public CosmosBulkExecutionOptions setExcludedRegions(List excludeRegions)

要为请求/重试排除的区域列表。 示例“美国东部”或“美国东部,美国西部”这些区域将从首选区域列表中排除

Parameters:

excludeRegions - 区域列表

Returns:

setInitialMicroBatchSize

public CosmosBulkExecutionOptions setInitialMicroBatchSize(int initialMicroBatchSize)

设置将发送到后端的微批的初始大小。 微批的大小将根据限制速率动态调整。 默认值为 100 - 因此,它从相对较大的微批开始,当限制速率过高时,它将减小批大小。 如果在动态减小初始批大小之前出现短时间限制峰值,导致对其他工作负荷产生副作用,则可以减小初始微批大小(例如设置为 1),此时会从小微批开始,然后随时间推移增加批大小。

Parameters:

initialMicroBatchSize - 要使用的初始微批大小。 必须是正整数。

Returns:

批量执行选项。

setMaxMicroBatchConcurrency

public CosmosBulkExecutionOptions setMaxMicroBatchConcurrency(int maxMicroBatchConcurrency)

为分区键范围设置执行请求的最大并发性。 默认情况下,maxMicroBatchConcurrency 为 1。 它只允许值 ?1 和 ?5。 注意! 请谨慎调整此值。 通过增大此值,将允许将更多并发请求发送到服务器,在这种情况下,可能会导致 429 或请求由于本地资源饱和而超时,这可能会降低性能。

Parameters:

maxMicroBatchConcurrency - 微批处理并发。

Returns:

批量处理选项。

setThroughputControlGroupName

public CosmosBulkExecutionOptions setThroughputControlGroupName(String throughputControlGroupName)

设置吞吐量控制组名称。

Parameters:

throughputControlGroupName - 吞吐量控制组名称。

Returns:

CosmosBulkExecutionOptions。

适用于