Object Storage & Blob StoragePresigned URLs & Access ControlMedium⏱️ ~3 min

Production Scale Patterns and Traffic Offloading Economics

Traffic Offloading Economics

Proxying data through application servers consumes bandwidth, memory, and CPU. A server handling 100 concurrent 10MB downloads needs 1GB of memory for buffering, significant network bandwidth, and CPU for encryption. Presigned URLs reduce this to generating 200 byte URLs.

Cost comparison: cloud egress costs $0.05-0.12 per GB. Compute for proxying adds another $0.01-0.03 per GB. Storage egress via presigned URL costs the same $0.05-0.12 but zero compute. At petabyte scale, this saves thousands monthly.

CDN Integration

Presigned URLs work with CDNs (Content Delivery Networks, geographically distributed cache servers). Generate a presigned URL, user requests it, CDN fetches from origin using the signed URL, caches the response. Subsequent requests hit CDN cache without touching origin.

The challenge: cached content needs the same URL. If each user gets a unique presigned URL, nothing caches. Solution: generate URLs with longer expiration, include only object specific parameters (not user specific). Or use CDN signed URLs instead, letting the CDN handle authorization.

Batch URL Generation

Generating presigned URLs is CPU bound: signature computation. A server can generate 10,000-50,000 URLs per second per core. For pages displaying 100 thumbnails, generate all URLs in one batch. Avoid N+1 patterns where each image triggers a separate URL generation.

Pre generate URLs for predictable access patterns. A photo gallery with 1000 images: generate all URLs when user opens gallery, not when each image scrolls into view. Trade slightly earlier expiration for better perceived performance.

Multi Region Considerations

Presigned URLs contain the storage endpoint. A URL for US East storage does not work for EU West storage. For multi region architectures, generate URLs pointing to the nearest replica. This requires knowing user location and which region holds their data.

Cross region replication adds complexity. If data replicates with delay, a URL for a just written object might hit a replica before replication completes. Use read after write consistent regions or delay URL generation until replication confirms.

🎯 When To Use: Presigned URLs excel for large file transfers where bandwidth savings justify the complexity. For small files under 100KB, proxying simplicity might outweigh bandwidth costs.
💡 Key Takeaways
Traffic offload saves compute: generating 200 byte URLs versus proxying gigabytes through your servers
Cost: proxying adds $0.01-0.03/GB compute cost on top of egress; presigned URLs eliminate compute cost
CDN integration requires consistent URLs for caching; use longer expiration and avoid user specific parameters
Batch URL generation: 10,000-50,000 URLs per second per core; pre generate for predictable access patterns
Multi region: URLs contain storage endpoint; generate URLs for nearest replica, handle replication lag
📌 Interview Tips
1Calculate the savings. 1PB monthly egress at $0.09/GB is $90K. Compute for proxying adds $10K-30K. Presigned URLs eliminate the compute cost entirely. At scale, this is real money.
2Explain CDN caching challenge. Each user getting presigned URL with their session token means zero cache hits. Solution: sign only the object path, use same URL for all users, let storage ACLs or CDN handle per user auth if needed.
3For batch generation, describe the pattern. Gallery loads, server generates 100 presigned URLs in one API call (parallel signing), returns all URLs, client renders immediately. Versus: render placeholder, fetch URL per image, waterfall of requests.
← Back to Presigned URLs & Access Control Overview