Skip to content

Commit bd9acf0

Browse files
authored
feat: Make sure that storm caching settings are resonable (#285)
* feat: Make sure that storm caching settings are reasonable It was possible to configure a hierarchical keyring with storm tracking settings that resulted in poor caching performance. If the grace period is greater than the TTL, this results in items being immediately retried.
1 parent c1bda2f commit bd9acf0

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

framework/aws-kms/aws-kms-hierarchical-keyring.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- [Update Cache Entry Identifier Formulas to shared cache across multiple Hierarchical Keyrings](../../changes/2024-09-13_cache-across-hierarchical-keyrings/change.md)
1414
- New optional parameter `Partition ID` used to distinguish Cryptographic Material Providers (i.e: Hierarchical Keyrings) writing to a cache
1515
- 0.1.0
16-
- Initital record
16+
- Initial record
1717

1818
## Implementations
1919

@@ -56,6 +56,20 @@ On initialization, the caller:
5656
- MAY provide a [Cache Type](#cache-type)
5757
- MAY provide a [Partition ID](#partition-id)
5858

59+
If the cache to initialize is a [Storm Tracking Cryptographic Materials Cache](../storm-tracking-cryptographic-materials-cache.md#overview)
60+
then the settings on the storm tracking cache need to be rational with respect to the settings for the keyring.
61+
For example, a TTL that is less than the storm tracking grace period will result poor caching behavior.
62+
This is because all entries would be immediately within the grace period.
63+
64+
For most purposes, the TTL should be much much greater than the grace period.
65+
66+
If the cache to initialize is a [Storm Tracking Cryptographic Materials Cache](../storm-tracking-cryptographic-materials-cache.md#overview)
67+
then the [Grace Period](../storm-tracking-cryptographic-materials-cache.md#grace-period) MUST be less than the [cache limit TTL](#cache-limit-ttl).
68+
69+
On initialization the Hierarchical Keyring MUST initialize a [cryptographic-materials-cache](../local-cryptographic-materials-cache.md) with the configured cache limit TTL and the max cache size.
70+
If no max cache size is provided, the cryptographic materials cache MUST be configured to a
71+
max cache size of 1000.
72+
5973
If the Hierarchical Keyring does NOT get a `Shared` cache on initialization,
6074
it MUST initialize a [cryptographic-materials-cache](../local-cryptographic-materials-cache.md)
6175
with the user provided cache limit TTL and the entry capacity.

framework/storm-tracking-cryptographic-materials-cache.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ Initialization MUST also provide
3838
- [Grace Period](#grace-period)
3939
- [Grace Interval](#grace-interval)
4040
- [FanOut](#fanout)
41-
- [Inflight TTL](#inflight-ttl).
42-
- [sleepMilli](#sleepmilli).
41+
- [Inflight TTL](#inflight-ttl)
42+
- [sleepMilli](#sleepmilli)
4343

4444
The implementation MUST instantiate a [Local CMC](local-cryptographic-materials-cache.md)
45-
to do the actual cacheing.
45+
to do the actual caching.
4646

4747
### Grace Period
4848

@@ -80,6 +80,24 @@ If the implementation must block, and no more intelligent signaling is used,
8080
then the implementation should sleep for this many milliseconds before
8181
reexamining the state of the cache.
8282

83+
## Consistency
84+
85+
The settings need to be consistent.
86+
87+
Here are examples of ambiguous or inconsistent settings:
88+
89+
- A grace interval that exceeds the grace period is inconsistent because only one attempt is made per grace interval and the grace period will end before the next interval.
90+
- An in flight TTL that exceeds the grace period is inconsistent because the grace period will expire before the in flight TTL.
91+
- An in flight TTL that is less than the grace interval is inconsistent because only one attempt is made per grace interval and even if the in flight TTL expires before the interval another attempt should not start.
92+
93+
Therefore
94+
95+
- The [Grace Interval](#grace-interval) MUST be less than or equal to the [Grace Period](#grace-period).
96+
- The [Inflight TTL](#inflight-ttl) MUST be less than or equal to the [Grace Period](#grace-period).
97+
- The [Grace Interval](#grace-interval) MUST be less than or equal to the [Inflight TTL](#inflight-ttl).
98+
99+
For most purposes, the [Grace Period](#grace-period) should be several times larger than the [Grace Interval](#grace-interval).
100+
83101
## Behaviors
84102

85103
The interface MUST be exactly the same as a [Local CMC](local-cryptographic-materials-cache.md),

0 commit comments

Comments
 (0)