Skip to content

Commit

Permalink
Implemented lookback-window-start option #192
Browse files Browse the repository at this point in the history
  • Loading branch information
sebdah committed Jul 15, 2014
1 parent 6cd5f04 commit fe142c9
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/configuration_options.rst
Expand Up @@ -72,6 +72,7 @@ num-read-checks-before-scale-down ``int`` 1 Force Dynamic
num-write-checks-before-scale-down ``int`` 1 Force Dynamic DynamoDB to have `x` consecutive positive results before scaling writes down (`1` means scale down immediately)
num-read-checks-reset-percent ``int`` 0 Set a read consumption percentage when the `num-read-checks-before-scale-down` count should be reset. This option is optional, even if you use the `num-read-checks-before-scale-down` feature
num-write-checks-reset-percent ``int`` 0 Set a write consumption percentage when the `num-write-checks-before-scale-down` count should be reset. This option is optional, even if you use the `num-write-checks-before-scale-down` feature
lookback-window-start ``int`` 15 Dynamic DynamoDB fetches data from CloudWatch in a window that streches between ``now()-15`` and ``now()-10`` minutes. If you want to look at slightly newer data, change this value. Please note that it might not be set to less than 5 minutes (as CloudWatch data for DynamoDB is updated every 5 minutes).
maintenance-windows ``str`` Force Dynamic DynamoDB to operate within maintenance windows. E.g. ``22:00-23:59,00:00-06:00``
enable-reads-up-scaling ``bool`` ``true`` Turn on or off of up scaling of read capacity
enable-reads-down-scaling ``bool`` ``true`` Turn on or off of down scaling of read capacity
Expand Down
2 changes: 2 additions & 0 deletions dynamic_dynamodb/config/__init__.py
Expand Up @@ -64,6 +64,7 @@
'allow_scaling_down_reads_on_0_percent': False,
'allow_scaling_down_writes_on_0_percent': False,
'always_decrease_rw_together': False,
'lookback-window-start': 15,
'maintenance_windows': None,
'sns_topic_arn': None,
'sns_message_types': []
Expand Down Expand Up @@ -104,6 +105,7 @@
'allow_scaling_down_reads_on_0_percent': False,
'allow_scaling_down_writes_on_0_percent': False,
'always_decrease_rw_together': False,
'lookback-window-start': 15,
'maintenance_windows': None,
'sns_topic_arn': None,
'sns_message_types': []
Expand Down
6 changes: 6 additions & 0 deletions dynamic_dynamodb/config/config_file_parser.py
Expand Up @@ -221,6 +221,12 @@
'option': 'writes-lower-alarm-threshold',
'required': False,
'type': 'int'
},
{
'key': 'lookback_window_start',
'option': 'lookback-window-start',
'required': False,
'type': 'int'
}
]

Expand Down
16 changes: 12 additions & 4 deletions dynamic_dynamodb/core/gsi.py
Expand Up @@ -164,12 +164,16 @@ def __ensure_provisioning_reads(

update_needed = False
try:
lookback_window_start = get_gsi_option(
table_key, gsi_key, 'lookback-window-start')
current_read_units = dynamodb.get_provisioned_gsi_read_units(
table_name, gsi_name)
consumed_read_units_percent = \
gsi_stats.get_consumed_read_units_percent(table_name, gsi_name)
gsi_stats.get_consumed_read_units_percent(
table_name, gsi_name, lookback_window_start)
throttled_read_count = \
gsi_stats.get_throttled_read_event_count(table_name, gsi_name)
gsi_stats.get_throttled_read_event_count(
table_name, gsi_name, lookback_window_start)
reads_upper_threshold = \
get_gsi_option(table_key, gsi_key, 'reads_upper_threshold')
reads_lower_threshold = \
Expand Down Expand Up @@ -365,12 +369,16 @@ def __ensure_provisioning_writes(

update_needed = False
try:
lookback_window_start = get_gsi_option(
table_key, gsi_key, 'lookback-window-start')
current_write_units = dynamodb.get_provisioned_gsi_write_units(
table_name, gsi_name)
consumed_write_units_percent = \
gsi_stats.get_consumed_write_units_percent(table_name, gsi_name)
gsi_stats.get_consumed_write_units_percent(
table_name, gsi_name, lookback_window_start)
throttled_write_count = \
gsi_stats.get_throttled_write_event_count(table_name, gsi_name)
gsi_stats.get_throttled_write_event_count(
table_name, gsi_name, lookback_window_start)
writes_upper_threshold = \
get_gsi_option(table_key, gsi_key, 'writes_upper_threshold')
writes_lower_threshold = \
Expand Down
16 changes: 12 additions & 4 deletions dynamic_dynamodb/core/table.py
Expand Up @@ -139,12 +139,16 @@ def __ensure_provisioning_reads(table_name, key_name, num_consec_read_checks):

update_needed = False
try:
lookback_window_start = get_table_option(
table_name, 'lookback-window-start')
current_read_units = dynamodb.get_provisioned_table_read_units(
table_name)
consumed_read_units_percent = \
table_stats.get_consumed_read_units_percent(table_name)
table_stats.get_consumed_read_units_percent(
table_name, lookback_window_start)
throttled_read_count = \
table_stats.get_throttled_read_event_count(table_name)
table_stats.get_throttled_read_event_count(
table_name, lookback_window_start)
reads_upper_threshold = \
get_table_option(key_name, 'reads_upper_threshold')
reads_lower_threshold = \
Expand Down Expand Up @@ -320,12 +324,16 @@ def __ensure_provisioning_writes(

update_needed = False
try:
lookback_window_start = get_table_option(
table_name, 'lookback-window-start')
current_write_units = dynamodb.get_provisioned_table_write_units(
table_name)
consumed_write_units_percent = \
table_stats.get_consumed_write_units_percent(table_name)
table_stats.get_consumed_write_units_percent(
table_name, lookback_window_start)
throttled_write_count = \
table_stats.get_throttled_write_event_count(table_name)
table_stats.get_throttled_write_event_count(
table_name, lookback_window_start)
writes_upper_threshold = \
get_table_option(key_name, 'writes_upper_threshold')
writes_lower_threshold = \
Expand Down

0 comments on commit fe142c9

Please sign in to comment.