Repository navigation
Description
Summary
StorageTiers in internal/storage/s3/tiers.go records a MinObjectSize for six storage classes.
Three of those values are AWS's published minimum billable object size. The other three are not
minimums at all:
| tier | tiers.go today |
what AWS publishes |
|---|---|---|
STANDARD |
0 | none ✅ |
STANDARD_IA |
128 * 1024 |
128 KB ✅ |
ONEZONE_IA |
128 * 1024 |
128 KB ✅ |
GLACIER_IR |
128 * 1024 |
128 KB ✅ |
INTELLIGENT_TIERING |
128 * 1024 |
none ❌ |
GLACIER |
40 * 1024 |
none ❌ |
DEEP_ARCHIVE |
40 * 1024 |
none ❌ |
Sources: the
storage class comparison table
lists "Min billable object size" as None for Intelligent-Tiering and NA for both Glacier Flexible
Retrieval and Deep Archive; S3 pricing states the 128 KB minimum for
Standard-IA, One Zone-IA, and Glacier Instant Retrieval and describes the Glacier classes differently.
What the wrong values actually are
GLACIER and DEEP_ARCHIVE — 40 KB is an overhead, not a floor. AWS charges 40 KB of additional
metadata per archived object: 32 KB at the archive rate plus 8 KB at the S3 Standard rate. That is added
to the object's real size, not a floor it is raised to. The two behave oppositely for cost modeling:
- a floor means compressing a 30 KB object to 10 KB saves nothing
- an overhead means it saves 20 KB of archive storage, against a fixed surcharge
Encoding an addition as a minimum gets the direction of every small-object recommendation wrong on the
two cheapest tiers.
INTELLIGENT_TIERING — 128 KB governs monitoring, not billing. From the same AWS table: no minimum
billable size. What 128 KB does there is bound auto-tiering eligibility — objects below it are not
monitored, always stay in the Frequent Access tier, and are not charged the monitoring and automation
fee. The current comment (// 128 KB minimum for optimization) is closer to right than the value is,
which is probably how it got in.
Impact
Reachable today only through the write gate, which is #154's subject:
TierValidator.ValidateWrite refuses any write below MinObjectSize, so on GLACIER or DEEP_ARCHIVE
it currently rejects writes under 40 KB that AWS would accept and bill correctly. #154 downgrades that
gate to a warning; this issue is about the numbers the warning would then report.
Once the values are advisory, wrong ones are worse than absent ones: a warning saying "this 30 KB object
will be billed as 40 KB on DEEP_ARCHIVE" is false in both the number and the mechanism.
Also note the units. AWS states these as KB and tiers.go computes 128 * 1024 — 131,072 bytes
against a published 128,000. A 2.4% error, in the conservative direction, and worth a comment either way
since internal/awsrates already documents that AWS bills decimal GB (GBFromBytes).
Fix
GLACIER,DEEP_ARCHIVE:MinObjectSize: 0, and represent the 40 KB as what it is. Either a separate
PerObjectOverheadBytesfield with the 32/8 KB split noted, or omit it from the struct and leave it to
the cost calculator — but do not leave it in a field named for a minimum.INTELLIGENT_TIERING:MinObjectSize: 0. If the 128 KB monitoring threshold is worth keeping, it
belongs in its own field with its own name.- Decide on KB versus KiB explicitly and comment the choice.
- Test that pins each value against the AWS-published figure with the source URL in the failure message,
in the style ofinternal/awsrates/rates_aws_test.go— that file exists because a table someone believed
is different from a table something checked.
Relationship to #154
Independent and complementary. #154 stops the table from failing writes; this fixes what the table says.
Doing #154 alone leaves ObjectFS emitting confidently wrong billing warnings; doing this alone leaves
mkdir broken on archive tiers. Either order works.
Provenance
Found while writing the compression guidance doc (#186), which had to state the billing minimums to
explain when compression saves money. The issue body for #186 carried the same two errors, taken from this
table — so the table has already propagated once into a spec.
Activity
docs: what transparent compression costs, measured rather than assert…