Skip to content

fix(bidding): restore cache TTL — v2.4.1 set TTL=0 disabling cache#43

Open
arikalon1 wants to merge 1 commit intomainfrom
fix/bidding-service-cache-ttl
Open

fix(bidding): restore cache TTL — v2.4.1 set TTL=0 disabling cache#43
arikalon1 wants to merge 1 commit intomainfrom
fix/bidding-service-cache-ttl

Conversation

@arikalon1
Copy link
Copy Markdown
Contributor

🚨 Incident: bidding-service — biddingRequestsRate dropped 70%

Summary

Deployment v2.4.1 introduced a critical cache misconfiguration that effectively disabled the Redis bid cache, causing all bid requests to bypass cache and hit the backend directly.

Root Cause

In cache/handler.go:44, the cache TTL was set to 0:

ttl := time.Duration(0) * time.Second

In Redis, a TTL of 0 means no expiration is set, but because the key is written and immediately considered volatile with zero duration, it is effectively expired on the next eviction cycle. This caused a 100% cache miss rate, leading to:

  • ⬇️ 70% drop in biddingRequestsRate
  • ⬆️ Backend request volume spiked 3.4×
  • ⬆️ p99 latency increased from 45ms → 380ms

Fix

  • Introduced DefaultBidCacheTTL = 300s constant
  • Replaced hardcoded time.Duration(0) with the named constant
  • 5-minute TTL balances data freshness with hit rate for auction workloads

Verification

After deploying this fix, expect:

  • biddingRequestsRate to recover to ~850 req/s within 5 minutes
  • Cache hit ratio to return to ~92%
  • p99 latency to drop back below 50ms

Root cause: deployment v2.4.1 introduced TTL=0 in cache/handler.go:44,
which tells Redis to expire keys immediately. This effectively disabled
the bid cache, causing every request to hit the backend directly and
dropping biddingRequestsRate by ~70%.

Fix: Replace hardcoded TTL=0 with DefaultBidCacheTTL (300s) constant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant