Caching Layers in Front of S3
Caching layers between compute and S3 cut both latency and egress costs simultaneously.
Sponsored by Archil

Latency and cost aren't two separate problems with S3. They're the same problem wearing different clothes depending on which line item you're staring at on your bill.
S3 pricing has two moving parts that punish you when your data is hot. Per-request charges: every GET costs money. Egress fees: every byte that leaves S3 costs money. Egress rates in 2025 start around $0.09 per GB and drop at higher volumes. Most workloads never reach the tiers where those discounts kick in.
The numbers compound faster than you'd expect. Take a 70B parameter FP16 model. That's roughly 140 GB. Load it once a day for a month and you're looking at approximately $378 in S3 egress alone. Before compute. Before anything else. And that's one model, one month, assuming nothing else is touching S3.
It gets uglier from there. Cross-region transfers add $0.02/GB. Private-subnet access through a NAT Gateway stacks a $0.045/GB processing charge on top of egress. These costs accumulate quietly in the background until your bill arrives and you spend an afternoon trying to figure out where it all went.
This isn't a niche complaint either. Surveys from 2024 and 2025 show 95% of IT leaders report unexpected cloud storage costs, and 55% cite egress as the biggest barrier to switching providers. A 2025 study found 94% of IT leaders still struggle to optimize cloud storage costs. The problem is persistent and widespread, not an edge case.
Caching addresses both sides at once. Fewer origin requests. Fewer egress events. An object served from cache costs zero additional S3 GET charges. It's faster and cheaper every single time you serve it from somewhere that isn't S3.

Where S3's Latency Ceiling Bites Hardest: AI Training and Inference
If there's one place where S3's latency ceiling gets genuinely expensive, fast, it's AI workloads. An idle GPU isn't free. It burns money whether it's computing or waiting around for data to show up.
Meta published findings from their training infrastructure showing 56% of GPU cycles stalled waiting for training data. More than half. That's not a rounding error in your utilization metrics. That's the cost of treating storage performance as someone else's problem until it lands on your desk.
More than half of organizations report data and storage bottlenecks that limit AI performance and scalability. And 57% of enterprises say their data isn't AI-ready. These aren't abstract statistics. The I/O demands of AI training are genuinely extreme, and the gap between what storage systems can deliver and what GPUs can consume keeps getting wider.
Here's why the structural problem is so bad. The total data moved during a training run is often 10 to 100 times the raw dataset size. Multi-epoch training means the same shards get read dozens of times over. That's a highly repetitive access pattern by design, and repetitive access is exactly what caching is built to exploit. Every cache hit during epoch three is data that was already paid for at epoch one.
Inference has its own version of this problem. Large language models recompute attention KV matrices on every new session, even when the prompt is identical to one from ten minutes ago. Persisting and reusing precomputed KV cache states across sessions can dramatically accelerate inference. How much depends on the backing storage tier and how the cache is architected.
Then there's the hardware reality. PCIe Gen5 NVMe SSDs now exceed 14 GB/s sequential read speeds. S3 Standard cannot come close to feeding these devices at rated speed without something sitting in between. The hardware has outrun the network endpoint by a wide margin, and that gap isn't closing.
For any AI workload with repeated data access, the question isn't whether to cache. It's which layer and at what granularity.
The Four Distinct Caching Layers, and What Each One Actually Solves
No single caching layer works for every access pattern. The right choice depends on who is accessing the data, how often, from where, and at what granularity. Get that wrong and you end up paying for infrastructure that doesn't actually help.
Here are the four main options, ordered from farthest to closest to the application:
- CDN / edge cache. Sits at geographic edge nodes. Built for internet-facing content delivery. Reduces latency by proximity to the end user.
- In-memory cache. Sits in the application tier (ElastiCache, for example). Reduces latency by eliminating network hops for the hottest objects.
- Hybrid memory-plus-disk cache. Sits close to compute, uses NVMe as a warm tier below RAM. Built for datasets too large for memory but too hot to keep fetching from S3.
- High-performance S3 storage class. S3 Express One Zone acts architecturally as a fast hot tier within the S3 namespace. Not a traditional cache, but teams use it that way.
There's a fifth pattern that doesn't fit cleanly into this taxonomy: a POSIX filesystem layer over object storage. It gets its own section.
These layers aren't mutually exclusive. A production system might stack a CDN in front of a hybrid disk cache in front of S3 Standard. The key variables are latency requirement, access frequency, dataset size relative to available RAM, read-versus-write ratio, and whether clients are geographically distributed.

CDN Edge Caching: The Right Tool for Internet-Facing Content and a Surprisingly Effective Cost Lever
CloudFront is the canonical AWS implementation. It caches S3 objects at geographically distributed points of presence and serves requests without touching the origin. For end users, that can translate to single-digit millisecond latency instead of 50-150ms from S3 Standard.
The cost structure changed in late 2024. AWS eliminated the S3-to-CloudFront intra-region transfer charge. It's now $0.00/GB to move data from S3 to CloudFront. That makes CloudFront strictly cheaper than direct S3 egress for internet-facing workloads, full stop.
- CloudFront egress to internet users: approximately $0.085/GB
- S3 direct internet egress: approximately $0.09/GB
- 10 TB/month directly from S3: roughly $922
- Routed through CloudFront: roughly $850, plus the caching benefit that reduces origin requests by 80-95% for cacheable content
The savings are real before you even factor in the cache hit rate. But CloudFront has a defined scope — know where the edges are.
What CDN edge caching does not solve:
- Write-heavy workloads
- Private compute-to-compute access (AI training pipelines never touch the internet)
- Intra-AWS latency between EC2 and S3
- Anything requiring POSIX semantics or strong consistency
It's the right call for media delivery, software distribution, static web assets, and applications where end-user geographic distance is the primary latency driver. Outside that scope, it doesn't move the needle.
In-Memory Caching with ElastiCache: The Lowest-Latency Option for a Hot Working Set That Fits in RAM
ElastiCache (Redis or Memcached) sits between the application and S3. The application checks the cache first, fetches from S3 on a miss, and writes the result to cache. That's the basic loop.
The latency improvement isn't incremental. It's a category shift. In-memory cache access is sub-millisecond. S3 Standard is 50-150ms-plus. That's a fundamentally different class of behavior, and applications that depend on fast lookups will feel the difference immediately.
The constraint is simple and non-negotiable: provisioned DRAM is expensive per GB. This approach only works when the working set actually fits in the allocated memory pool. When the dataset outgrows the cache, hit rates drop and S3 requests start leaking through at full cost and full latency.
Two things that matter more than most teams realize upfront:
- Eviction strategy. LRU is the default, but workloads with Zipfian distributions (where a small fraction of objects gets the vast majority of requests) will see much better hit rates than workloads with flat or random access patterns. Know your access distribution before you tune this.
- Write path. Write-through (write to S3 and cache atomically) is safer. Write-back (write to cache, flush to S3 asynchronously) is faster but risks losing data if the cache node fails before flushing. The tradeoff is real and the consequences aren't symmetric.
Good fit: session data, frequently-read configuration objects, hot metadata, small model artifacts. Anything read-heavy with a stable working set that fits in memory. Not the right call for multi-hundred-GB training datasets, streaming workloads with no temporal locality, or anything that needs filesystem semantics.
Hybrid Memory-and-Disk Caching: The Architecture for Data Too Large for RAM but Too Hot for S3
Training datasets and analytics working sets routinely exceed what fits in DRAM. But pulling from S3 on every access isn't acceptable either, not at the access rates these workloads generate. NVMe SSD sits in the middle: meaningfully better latency than S3, far larger capacity than RAM.
The architecture layers like this:
- Memory cache for the hottest objects (sub-millisecond access)
- NVMe disk cache for the warm tier (low single-digit milliseconds)
- S3 as the durable backing store (requests fall through on a miss)
Eviction policy matters more here than people typically expect. Policies like w-TinyLFU and SIEVE are specifically designed to resist cache pollution from one-time scan patterns. That's important for training workloads where epoch boundaries can flush useful state you'll need again during the next pass through the data. LRU will betray you here.
Optimized architectures combining local NVMe caching with parallelization and prefetching can deliver meaningfully higher throughput than conventional S3 over HTTP. AWS's own ML best practices from 2025 recommend consolidating training data into shards of 100 MB to 1 GB and using sequential access patterns. Caching frequently accessed shards in this setup compounds the benefit across multiple epochs.
One thing that catches teams off guard: cache warming time. A cold NVMe cache on a new node means the first epoch serves from S3. The second epoch hits the disk cache. For large datasets, that first-epoch penalty is real and needs to be planned for, not discovered mid-run.
Good fit: AI training data pipelines, large-scale analytics, any workload where the active dataset is measured in hundreds of gigabytes to terabytes and access patterns repeat within a session.
S3 Express One Zone as a High-Performance Hot Tier Within the S3 Namespace
S3 Express One Zone launched in late 2023. It's not a traditional cache, but teams use it as one, and AWS has published architectures that validate this pattern, so it's useful to understand it on those terms.
The pitch: approximately 10x faster than S3 Standard, higher request throughput, and read and write operations cost roughly 25% of what S3 Standard charges per request. The use pattern is straightforward. Hot or active data lives in Express One Zone. Colder, durable data stays in S3 Standard. Application logic or a pipeline promotes and demotes objects between classes based on access patterns.
The tradeoffs are significant and should be understood upfront.
Durability: Express One Zone stores data in a single Availability Zone. A zone failure loses that data. S3 Standard replicates across at least three AZs. That's not a footnote. It's a fundamental architectural difference that changes what you can safely store there.
Cost: Storage runs 3-4x more expensive per GB than S3 Standard. The economics only work when request-cost savings and latency improvements outweigh the storage premium, which typically means a small, heavily-accessed hot set, not large datasets parked there out of convenience.
What it still doesn't give you: It's still a remote HTTP endpoint. There's no in-process memory locality, no NVMe bandwidth, no POSIX semantics. The latency floor is 5-10ms, not sub-millisecond. If your workload needs lower than that, look at the layers closer to compute.
Good fit: database buffer pools, high-request-rate metadata stores, temporary working data during compute jobs. Cases where S3 API compatibility matters and a 5-10ms floor is acceptable.
POSIX Filesystem Layers Over S3: When the Application Can't Be Adapted to Object Storage Semantics
Sometimes the constraint isn't latency or cost. It's that the application expects a filesystem and you're not in a position to change it. That situation is more common than people admit.
Object storage and POSIX filesystems are fundamentally different things. Object storage uses flat namespaces, eventual consistency, and HTTP verbs. POSIX filesystems use hierarchical directories, atomic renames, append operations, and strict consistency semantics. Scientific computing workloads, traditional ML frameworks, legacy data pipelines, and HPC applications are often written against POSIX assumptions. Rewriting them to use the S3 SDK is expensive, risky, or simply not on the table.
POSIX filesystem layers over S3 solve this by presenting a filesystem interface while using object storage as the backend. The application sees directories, files, and standard syscalls. The layer translates those into object storage operations underneath.
A few tradeoffs show up consistently across implementations:
- Metadata operations are where object storage backends struggle most. Listing a directory, renaming a file, checking permissions: these map awkwardly onto object storage semantics and often become the bottleneck under load.
- Consistency is complicated. True POSIX consistency is hard to guarantee when the backend is eventually consistent at scale.
- Caching is where implementations differentiate most. A POSIX layer with an NVMe cache close to compute delivers a very different performance profile than one that passes every syscall through to S3 as a synchronous HTTP call.
Some tools in this space mount S3, GCS, R2, or Azure Blob buckets as a POSIX filesystem with NVMe caching, reading from the hot tier at sub-millisecond latency and fetching misses from the source on demand. Billing only on actively cached data sidesteps the data-movement tax that makes some alternative approaches expensive to operate.
Other approaches in this space include FUSE-based mounts (simpler, generally slower), cluster-aware distributed filesystems for HPC, and managed NFS services that front object storage with traditional filesystem semantics.
Good fit: HPC and scientific workloads, legacy ML frameworks, any pipeline where the code expects a filesystem and modifying it to use object storage APIs directly isn't realistic. If your constraint is "I cannot rewrite this code," this is where to start.
This article is sponsored by Archil.


