protected AutoscalingConfigurationSet(IAutoscalingConfigurationSet configurationSet)
 {
     DemoMode = configurationSet.DemoMode;
     IncreaseInterval = configurationSet.IncreaseInterval;
     DecreaseInterval = configurationSet.DecreaseInterval;
     Reads = new AutoscalingConfiguration(configurationSet.Reads);
     Writes = new AutoscalingConfiguration(configurationSet.Writes);
 }
        public async Task EnsureProvisioningAsync_ShouldNotCallUpdateOnClientWhenValuesAreTheSame()
        {
            var readsConfiguration = new AutoscalingConfiguration {EnableAutoscaling = true};
            var writesConfiguration = new AutoscalingConfiguration {EnableAutoscaling = true};
            var configurationSet = new TableAutoscalingConfigurationSet
            {
                TableName = tableName, DemoMode = false, Reads = readsConfiguration, Writes = writesConfiguration,
            };
            var provisioned = new DynamoDbTableThroughput { ReadThroughput = 500, WriteThroughput = 1000 };
            var updated = new DynamoDbTableThroughput { ReadThroughput = 500, WriteThroughput = 1000 };

            await tableProvisioner.ProvisionAsync(configurationSet, provisioned, updated);

            throughputClientMock.Verify(
                client => client.SetTableThroughputLevelAsync(tableName, 500, 1000, default(CancellationToken)),
                Times.Never);
        }
예제 #3
0
        internal long ComputeUpdatedProvisioned(
            long provisioned,
            AutoscaleDirection autoscaleDirection,
            DynamoDbThroughputMetrics metrics,
            AutoscalingConfiguration configuration)
        {
            var increasePercent = configuration.IncreaseWithPercent.GetValueOrDefault();
            var decreasePercent = configuration.DecreaseWithPercent.GetValueOrDefault();
            var minProvisioned = configuration.MinProvisioned.GetValueOrDefault();
            var maxProvisioned = configuration.MaxProvisioned.GetValueOrDefault();

            return ComputeUpdatedProvisioned(
                autoscaleDirection, provisioned, increasePercent, decreasePercent, minProvisioned, maxProvisioned);
        }
예제 #4
0
        internal AutoscaleDirection ComputeScaleDirection(
            bool isCircuitBreakerTripped,
            long provisioned,
            DynamoDbThroughputMetrics metrics,
            AutoscalingConfiguration configuration)
        {
            var upperThreshold = configuration.UpperThreshold.GetValueOrDefault();
            var lowerThreshold = configuration.LowerThreshold.GetValueOrDefault();
            var throttleThreshold = configuration.ThrottleThreshold.GetValueOrDefault();

            return ComputeScaleDirection(
                isCircuitBreakerTripped, provisioned, metrics.ConsumedCapacityUnits, upperThreshold, lowerThreshold, throttleThreshold,
                metrics.ThrottleEvents, metrics.ConsumptionDirection, metrics.ThrottleDirection);
        }
예제 #5
0
 internal long EnsureProvision(
     bool isCircuitBreakerTripped,
     long provisioned, 
     DynamoDbThroughputMetrics metrics,
     AutoscalingConfiguration configuration)
 {
     var scaleDirection = ComputeScaleDirection(isCircuitBreakerTripped, provisioned, metrics, configuration);
     var updated = ComputeUpdatedProvisioned(provisioned, scaleDirection, metrics, configuration);
     return updated;
 }
 protected AutoscalingConfigurationSet()
 {
     Reads = new AutoscalingConfiguration();
     Writes = new AutoscalingConfiguration();
 }