You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Per-partition throttling takes the first attribute of Key or Item as the partition key #779
Per-partition throttling chooses an item's bucket by the first attribute in Key or Item, which is not always the partition key.
extract_partition_value in crates/server/src/throttle_helpers.rs (lines 101 to 118 on main at 82445c5) returns the value of the first member of Key for GetItem, DeleteItem and UpdateItem, and of Item for PutItem. Its comment says DynamoDB key maps are ordered. They are not, and the parsed request body is sorted by attribute name on the SQLite, PostgreSQL and Cassandra builds; the fix for #723 sorts it on the MongoDB build too.
So a PutItem of {"pk": {"S": "user-1"}, "data": {"S": "x"}} is counted against the bucket for x, because data sorts before pk. Items whose first attribute in name order holds the same value share one bucket whatever their partition key, and a first attribute of a type other than S, N or B (a map, a list, a set, BOOL or NULL) gives the empty string, so all such items share one bucket.
Expected: read the partition key's name from the table's key schema and take that attribute's value.
Measured on a SQLite server: a release build of #398's branch with main merged, throttling_enabled true, 23 Nov 2026. The partition buckets refill at 1,000 WCU and 3,000 RCU a second and start with one second of capacity.
PutItem of 390,000-byte items, 381 WCU each, on a table keyed by pk. Ten items with one pk and a different a each, in 73 ms: all ten got 200. A bucket keyed by pk would refuse the fourth. Ten items with a different pk each and one a: three got 200, then seven got 400 ProvisionedThroughputExceededException. The bucket follows a, the first attribute by name.
Strongly consistent GetItem of 390,000-byte items, 96 RCU each, on a table with partition key zpk and sort key ask. 100 reads of one zpk over ten ask values, in 434 ms: all 100 got 200. 100 reads of ten zpk values with one ask: from the 41st read on, 57 got 400. The bucket follows ask, the sort key, because it sorts before zpk.
Every request sent the partition key first in the JSON. #1377 and #1381 change how extract_partition_value reads the value and keep the first attribute.
Activity
LeeroyHannigan commentedon Nov 23, 2026
Measured on a SQLite server: a release build of #398's branch with main merged,
throttling_enabledtrue, 23 Nov 2026. The partition buckets refill at 1,000 WCU and 3,000 RCU a second and start with one second of capacity.pk. Ten items with onepkand a differentaeach, in 73 ms: all ten got 200. A bucket keyed bypkwould refuse the fourth. Ten items with a differentpkeach and onea: three got 200, then seven got 400ProvisionedThroughputExceededException. The bucket followsa, the first attribute by name.zpkand sort keyask. 100 reads of onezpkover tenaskvalues, in 434 ms: all 100 got 200. 100 reads of tenzpkvalues with oneask: from the 41st read on, 57 got 400. The bucket followsask, the sort key, because it sorts beforezpk.Every request sent the partition key first in the JSON. #1377 and #1381 change how
extract_partition_valuereads the value and keep the first attribute.