Skip to content

Commit

Permalink
Merge branch 'release/2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebdah committed Sep 30, 2015
2 parents 3fca1c5 + 300f319 commit c20e724
Show file tree
Hide file tree
Showing 11 changed files with 708 additions and 217 deletions.
Binary file modified .ropeproject/globalnames
Binary file not shown.
7 changes: 2 additions & 5 deletions docs/configuration_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ Table configuration

Important note: The table name is treated as a regular expression. That means that ``my_table`` also will match ``my_table2``, unless you express it as a valid regular expression; ``^my_table$``. This feature enables you to easily configure many tables or tables with dynamic names.

Please note also that DynamoDB writes CloudWatch data every 5 minutes, thus ``reads/writes-upper/lower-threshold`` and ``throttled-reads/writes-upper-threshold`` is counted over 5 minute intervals.

=============================================== ========= =========================== ==========================================
Option Type Default Comment
=============================================== ========= =========================== ==========================================
Expand Down Expand Up @@ -93,7 +91,8 @@ increase-throttled-by-provisioned-writes-scale ``dict``
Detailed information on the scale dict can be found `here <http://dynamic-dynamodb.readthedocs.org/en/latest/granular_scaling.html>`__.
increase-writes-unit ``str`` ``percent`` Set if we should scale up in ``units`` or ``percent``
increase-writes-with ``int`` 50 Number of ``units`` or ``percent`` we should scale up the write provisioning with. Choose entity with ``increase-writes-unit``.
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).
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 1 minute (as CloudWatch data for DynamoDB is updated every minute).
lookback-period ``int`` 5 Changes the duration of CloudWatch data to look at. For example, instead of looking at ``now()-15`` to ``now()-10``, you can look at ``now()-15`` to ``now()-14``
maintenance-windows ``str`` Force Dynamic DynamoDB to operate within maintenance windows. E.g. ``22:00-23:59,00:00-06:00``
max-provisioned-reads ``int`` Maximum number of provisioned reads for the table
max-provisioned-writes ``int`` Maximum number of provisioned writes for the table
Expand Down Expand Up @@ -129,8 +128,6 @@ Important note: Both the GSI name and the table name is treated as regular expre

The ``table:`` section after ``gsi:`` **must** match with an existing ``table:`` section.

Please note also that DynamoDB writes CloudWatch data every 5 minutes, thus ``reads/writes-upper/lower-threshold`` and ``throttled-reads/writes-upper-threshold`` is counted over 5 minute intervals.

=============================================== ========= =========================== ==========================================
Option Type Default Comment
=============================================== ========= =========================== ==========================================
Expand Down
11 changes: 9 additions & 2 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
Release notes
=============

2.0.2
2.1.0
-----

**Release date:** 2015-09-30

- Use HTTP rather than SSH for git clone (`#266 <https://github.com/sebdah/dynamic-dynamodb/issues/266>`). Thanks for the pull request `@superprat <https://github.com/superprat>`
- Support for granular downscaling (`#263 <https://github.com/sebdah/dynamic-dynamodb/issues/263>`). Thanks for the pull request `@Sazpaimon <https://github.com/Sazpaimon>`
- Allow configurable lookback period instead of the hardcoded 5 minute one (`#261 <https://github.com/sebdah/dynamic-dynamodb/issues/261>`). Thanks for the pull request `@Sazpaimon <https://github.com/Sazpaimon>`
- Don't scale down if it would scale below the current consumed units (`#268 <https://github.com/sebdah/dynamic-dynamodb/issues/261>`). Thanks for the pull request `@Sazpaimon <https://github.com/Sazpaimon>`

2.0.2
-----

**Release date:** 2015-09-30

- Use HTTP rather than SSH for git clone (`#266 <https://github.com/sebdah/dynamic-dynamodb/issues/266>`). Thanks for the pull request `@superprat <https://github.com/superprat>`

2.0.1
-----
Expand Down
19 changes: 19 additions & 0 deletions dynamic_dynamodb/calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,25 @@ def increase_writes_in_units(
return updated_provisioning


def is_consumed_over_proposed(
current_provisioning, proposed_provisioning, consumed_units_percent):
"""
Determines if the currently consumed capacity is over the proposed capacity
for this table
:type current_provisioning: int
:param current_provisioning: The current provisioning
:type proposed_provisioning: int
:param proposed_provisioning: New provisioning
:type consumed_units_percent: float
:param consumed_units_percent: Percent of consumed units
:returns: bool - if consumed is over max
"""
consumption_based_current_provisioning = \
int(math.ceil(current_provisioning*(consumed_units_percent/100)))
return consumption_based_current_provisioning > proposed_provisioning


def __get_min_reads(current_provisioning, min_provisioned_reads, log_tag):
""" Get the minimum number of reads to current_provisioning
Expand Down
30 changes: 21 additions & 9 deletions dynamic_dynamodb/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
'allow_scaling_down_writes_on_0_percent': False,
'always_decrease_rw_together': False,
'lookback_window_start': 15,
'lookback_period': 5,
'maintenance_windows': None,
'sns_topic_arn': None,
'sns_message_types': [],
Expand All @@ -86,7 +87,13 @@
'increase_throttled_by_consumed_reads_unit': None,
'increase_throttled_by_consumed_reads_scale': None,
'increase_throttled_by_consumed_writes_unit': None,
'increase_throttled_by_consumed_writes_scale': None
'increase_throttled_by_consumed_writes_scale': None,
'decrease_consumed_reads_unit': None,
'decrease_consumed_reads_with': None,
'decrease_consumed_reads_scale': None,
'decrease_consumed_writes_unit': None,
'decrease_consumed_writes_with': None,
'decrease_consumed_writes_scale': None,
},
'gsi': {
'reads-upper-alarm-threshold': 0,
Expand Down Expand Up @@ -125,6 +132,7 @@
'allow_scaling_down_writes_on_0_percent': False,
'always_decrease_rw_together': False,
'lookback_window_start': 15,
'lookback_period': 5,
'maintenance_windows': None,
'sns_topic_arn': None,
'sns_message_types': [],
Expand Down Expand Up @@ -405,10 +413,10 @@ def __check_gsi_rules(configuration):
sys.exit(1)

# Check lookback-window start
if gsi['lookback_window_start'] < 5:
if gsi['lookback_window_start'] < 1:
print(
'lookback-window-start must be a value higher than 5, '
'as DynamoDB sends CloudWatch data every 5 minutes')
'lookback-window-start must be a value higher than 1, '
'as DynamoDB sends CloudWatch data every minute')
sys.exit(1)

# Check sns-message-types
Expand Down Expand Up @@ -440,13 +448,17 @@ def __check_gsi_rules(configuration):
'min_provisioned_writes',
'max_provisioned_writes',
'increase_consumed_reads_with',
'increase_consumed_writes_with'
'increase_consumed_writes_with',
'decrease_consumed_reads_with',
'decrease_consumed_writes_with'
]
# Config options without a mandatory default
# should be allowed a None value
non_default = [
'increase_consumed_reads_with',
'increase_consumed_writes_with'
'increase_consumed_writes_with',
'decrease_consumed_reads_with',
'decrease_consumed_writes_with'
]

for option in options:
Expand Down Expand Up @@ -567,10 +579,10 @@ def __check_table_rules(configuration):
sys.exit(1)

# Check lookback-window start
if table['lookback_window_start'] < 5:
if table['lookback_window_start'] < 1:
print(
'lookback-window-start must be a value higher than 5, '
'as DynamoDB sends CloudWatch data every 5 minutes')
'lookback-window-start must be a value higher than 1, '
'as DynamoDB sends CloudWatch data every minute')
sys.exit(1)

# Check sns-message-types
Expand Down
42 changes: 42 additions & 0 deletions dynamic_dynamodb/config/config_file_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@
'required': False,
'type': 'int'
},
{
'key': 'lookback_period',
'option': 'lookback-period',
'required': False,
'type': 'int'
},
{
'key': 'increase_throttled_by_provisioned_reads_unit',
'option': 'increase-throttled-by-provisioned-reads-unit',
Expand Down Expand Up @@ -329,6 +335,42 @@
'option': 'increase-consumed-writes-scale',
'required': False,
'type': 'dict'
},
{
'key': 'decrease_consumed_reads_unit',
'option': 'decrease-consumed-reads-unit',
'required': False,
'type': 'str'
},
{
'key': 'decrease_consumed_reads_with',
'option': 'decrease-consumed-reads-with',
'required': False,
'type': 'int'
},
{
'key': 'decrease_consumed_reads_scale',
'option': 'decrease-consumed-reads-scale',
'required': False,
'type': 'dict'
},
{
'key': 'decrease_consumed_writes_unit',
'option': 'decrease-consumed-writes-unit',
'required': False,
'type': 'str'
},
{
'key': 'decrease_consumed_writes_with',
'option': 'decrease-consumed-writes-with',
'required': False,
'type': 'int'
},
{
'key': 'decrease_consumed_writes_scale',
'option': 'decrease-consumed-writes-scale',
'required': False,
'type': 'dict'
}
]

Expand Down

0 comments on commit c20e724

Please sign in to comment.