Share via


Update-ServiceFabricPartitionLoad

Updates loads of specified Service Fabric partitions.

Syntax

AllPages (Default)

Update-ServiceFabricPartitionLoad

    [-PartitionMetricLoadDescriptionList] <System.Collections.Generic.List`1[System.Fabric.Description.PartitionMetricLoadDescription]>
    [-ContinuationToken <String>]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

SinglePage

Update-ServiceFabricPartitionLoad

    [-PartitionMetricLoadDescriptionList] <System.Collections.Generic.List`1[System.Fabric.Description.PartitionMetricLoadDescription]>
    [-GetSinglePage]
    [-ContinuationToken <String>]
    [-MaxResults <Int64>]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

Description

The Update-ServiceFabricPartitionLoad cmdlet updates the loads of Service Fabric partitions, as specified via PartitionMetricLoadDescriptionList, and then returns the results.

Before you perform any operation on a Service Fabric cluster, establish a connection to the cluster by using the Connect-ServiceFabricCluster cmdlet.

Examples

Example 1: Use Update-ServiceFabricParitionLoad to report various loads for a partition

# This demonstrates various ways in which Update-ServiceFabricPartitionLoad can be used to report loads for a partition
# Part 1: reporting primary load for one or more metrics
# Part 2: reporting secondary load for one or more metrics
# Part 3: reporting loads for a given replica on a given node

# We need a guid object to identify the partition
$partitionIdString = '12345678-9012-4242-9876-432109876543'
$partitionId = [GUID]$partitionIdString

# Part 1: report primary load 42 for Metric0 and 43 for Metric1
$primaryLoad0 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric0', 42)
$primaryLoad1 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric1', 43)
$primaryLoads = New-Object 'System.Collections.Generic.List[System.Fabric.Description.MetricLoadDescription]'
$primaryLoads.Add($primaryLoad0)
$primaryLoads.Add($primaryLoad1)

# Part 2: report secondary load 5 for Metric0 and 6 for Metric1
$secondaryLoads = New-Object 'System.Collections.Generic.List[System.Fabric.Description.MetricLoadDescription]'
$secondaryLoad0 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric0', 5)
$secondaryLoad1 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric1', 6)
$secondaryLoads.Add($secondaryLoad0)
$secondaryLoads.Add($secondaryLoad1)

# Part 3a: for the replica on Node0 report a load of 42 for Metric0 and 24 for Metric1
$perNodeSecondaryLoads0 = New-Object 'System.Collections.Generic.List[System.Fabric.Description.MetricLoadDescription]'
$perNodeSecondaryLoad00 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric0', 42)
$perNodeSecondaryLoad01 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric1', 24)
$perNodeSecondaryLoads0.Add($perNodeSecondaryLoad00)
$perNodeSecondaryLoads0.Add($perNodeSecondaryLoad01)
$perNodeLoadsNode0 = New-Object -TypeName System.Fabric.Description.ReplicaMetricLoadDescription("Node0", $perNodeSecondaryLoads0)

# Part 3b: for the replica on Node1 report a load of 5 for Metric0 and 6 for Metric1
$perNodeSecondaryLoads1 = New-Object 'System.Collections.Generic.List[System.Fabric.Description.MetricLoadDescription]'
$perNodeSecondaryLoad10 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric0', 5)
$perNodeSecondaryLoad11 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric1', 6)
$perNodeSecondaryLoads1.Add($perNodeSecondaryLoad10)
$perNodeSecondaryLoads1.Add($perNodeSecondaryLoad11)
$perNodeLoadsNode1 = New-Object -TypeName System.Fabric.Description.ReplicaMetricLoadDescription("Node1", $perNodeSecondaryLoads1)

# Part 3c: put all node loads in an aggregate list
$perNodeLoads = New-Object 'System.Collections.Generic.List[System.Fabric.Description.ReplicaMetricLoadDescription]'
$perNodeLoads.Add($perNodeLoadsNode0)
$perNodeLoads.Add($perNodeLoadsNode1)

# Generate a description object which can contain all 3 load types (primary, secondary and per node)
# Empty dummy lists can be passed to the constructor if not all 3 types of reporting are used
$loadDescription = New-Object -TypeName System.Fabric.Description.PartitionMetricLoadDescription($partitionId, $primaryLoads, $secondaryLoads, $perNodeLoads)

# Create the final list of descriptions
# In this example we are reporting the load for a single partition
# But in general, more descriptions can be added to partitionMetricLoadDescriptionList
# This way, loads for multiple partitions can be reported through a single Update-ServiceFabricPartitionLoad call
$partitionMetricLoadDescriptionList = New-Object 'System.Collections.Generic.List[System.Fabric.Description.PartitionMetricLoadDescription]'
$partitionMetricLoadDescriptionList.Add($loadDescription)

# Finally, report the loads
Update-ServiceFabricPartitionLoad -PartitionMetricLoadDescriptionList $partitionMetricLoadDescriptionList

See also Reporting load for a partition.

Parameters

-ContinuationToken

Specifies the continuation token which can be used to retrieve the next page of query results.

If too many results respect the provided filters, they may not fit into one message. Paging is used to account for this by splitting the collection of returned results into separate pages. The continuation token is used to know where the previous page left off, carrying significance only to the query itself. This value should be generated from running this query, and can be passed into the next query request in order to get subsequent pages. A non-null continuation token value is returned as part of the result only if there is a subsequent page. If this value is provided without the -GetSinglePage option, then the query will return all pages starting from the continuation token value.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-GetSinglePage

Specifies whether the query will return one page of query results with a continuation token value, or all pages combined into one list of results. If this option is selected, then it is the responsibility of the caller of the query to check for subsequent pages.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SinglePage
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MaxResults

Specifies the max number of result items that can be returned per page. This defines the upper bound for the number of results returned, not a minimum. For example, if the page fits at most 1000 returned items according to max message size restrictions defined in the configuration, and the MaxResults value is set to 2000, then only 1000 results are returned, even if 2000 result items match the query description. This value requires selection of the GetSinglePage flag; it will be ignored otherwise.

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SinglePage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionMetricLoadDescriptionList

List of PartitionMetricLoadDescription objects that specify load updates for specific Service Fabric partitions.

Parameter properties

Type:

System.Collections.Generic.List`1[System.Fabric.Description.PartitionMetricLoadDescription]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TimeoutSec

Specifies the time-out period, in seconds, for the operation.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

System.Collections.Generic.List`1

Outputs

System.Object