पाठ 27 / 30

Optimising Cost Without Breaking Capacity

यह पाठ अभी हिंदी में अनुवादित नहीं है, इसलिए अंग्रेज़ी में दिखाया जा रहा है।

Apply rightsizing, autoscaling, storage tiering, caching and compression and estimate their savings.

लेखक: · 15 साल से वेब डेवलपर

Cheap capacity is unused capacity removed

Cost optimisation starts with the same estimates used for planning. Rightsizing: compare provisioned resources with measured peak plus headroom; an instance at 10% CPU all month is waste. Autoscaling: scale stateless tiers with the daily curve so you pay for the peak only during the peak. Storage tiering: move rarely read data to cheaper infrequent-access or archive tiers, and set lifecycle rules to delete what you no longer need; note that cold tiers may charge more per retrieval and can be slow to read. Caching and CDNs: each cache hit avoids compute and database work, and CDN hits avoid origin egress. Compression and efficient formats: compressing text responses, logs and stored data reduces bandwidth and storage, at some CPU cost. Batching: fewer, larger writes reduce per-request charges and IOPS. Always check that an optimisation does not move the bottleneck elsewhere or remove the headroom you planned for.

Estimating a tiering saving

All rates below are made-up placeholders for practice; always take real rates from your provider's current pricing page.

total_tb = 500
hot_fraction = 0.15          # read often in the last 30 days
hot_rate = 20.0              # $ per TB-month (placeholder)
cold_rate = 5.0              # $ per TB-month (placeholder)

before = total_tb * hot_rate
after = total_tb * hot_fraction * hot_rate + total_tb * (1 - hot_fraction) * cold_rate
print(f"all hot : ${before:,.0f}/month")
print(f"tiered  : ${after:,.0f}/month")
print(f"saving  : {1 - after / before:.0%}")

Output:

all hot : $10,000/month
tiered  : $3,625/month
saving  : 64%

Check retrieval costs before tiering

Archive tiers are cheap to store but can be slow and charge for retrieval. Tiering data that is actually read often can cost more than it saves.

त्वरित जाँच: A fleet of stateless web servers runs at 70% CPU in the evening peak and 10% overnight. Which optimisation fits best?

  • Move the servers to an archive storage tier
  • Increase the replication factor
  • Autoscale the fleet with the daily traffic curve
  • Shard the web servers
Answer

Autoscale the fleet with the daily traffic curve — Stateless tiers can add and remove instances with load, so autoscaling removes the overnight idle cost while preserving the evening peak capacity.