Class CosmosContainerProactiveInitConfig

java.lang.Object
com.azure.cosmos.CosmosContainerProactiveInitConfig

public final class CosmosContainerProactiveInitConfig extends Object
Encapsulates the list of container identities and no. of proactive connection regions.
  • Method Details

    • getCosmosContainerIdentities

      public List<CosmosContainerIdentity> getCosmosContainerIdentities()
      Gets the list of container identities. The returned list is protected against modifications.
      Returns:
      list of CosmosContainerIdentity
    • getProactiveConnectionRegionsCount

      public int getProactiveConnectionRegionsCount()
      Gets the no. of proactive connection regions

      Proactive connection regions constitute those regions where replicas of container partitions have connections opened to prior to performing any workload on the container. This way the latency associated with opening connections does not impact the latency associated with performing workloads on the container. These connections are opened synchronously when the CosmosClient/CosmosAsyncClient is built.

      These proactive connection regions are a subset of the preferred regions configured through the CosmosClientBuilder. The first getProactiveConnectionRegionsCount() read regions from preferred regions are picked. In this context a write-region could also be a read-region but not vice-versa.

      Consider a multi-master account with client configured with preferred regions - "US West" (write-region) and "US East" (write-region)
      1. If the no. of proactive regions is set to two, connections to "US West" and "US East" are opened proactively.
      2. If the no. of proactive regions is set to one, connections to "US West" are opened proactively.

      Consider a single-master account with client configured with preferred regions - "US West" (read-region), "US East" (read-region) and "West Europe" (write-region)
      1. If the no. of proactive regions is set to two, connections to "US West" and "US East" are opened proactively. If your application has workloads which are write-heavy it is important to prioritize write regions in the list of preferred regions.

      Returns:
      no. of proactive connection regions
    • toString

      public String toString()
      Overrides:
      toString in class Object