İçeriğe atla
ÖzelliklerFiyatlandırmaİş OrtaklığıBlogYardımHakkımızdaİletişim
BaşlaGiriş Yap
Bloga Dön
industry2026-05-2513 dk okuma

AI menu chat yavasladi quota probe-loop 1000 D1 write per request atomic counter — VV F1 (PR #575)

Adana Cukurova 47-yas Adana Kebabi Galip Usta 60-cover Adana kebabi + icli kofte + lahmacun + salgam suyu 20-yil sahibi Galip Usta thMenu Pro 16 ay ai-menu-chat 3 ay aktif allerji vejetaryen sorular. 23 Mayis Cuma 19:30 dinner rush iki musteri sikayet 8-10 saniye AI yanit bekliyorlar. Galip kendi test tavuk 12 saniye + vejetaryen 14 saniye normal 2-3 saniye. Support 25 dakika ack Sentry /api/ai-menu-chat avg latency 11.4s normal 2.3s 5× yavaslama. Handler trace AI daily quota check 7-12 saniye suruyor diger steps normal. apps/web-menu/src/lib/ai-quota.ts checkAiDailyQuota probe-loop for slot 0..LIMIT-1 INSERT OR IGNORE cron_idempotency_claims claim_key ai-quota:restaurant:today:slot changes>0 return allowed all 2000 taken return capped. Cuma 18:00 bot Galip endpoint abuse 15-dakika 2000 AI request gunluk quota tukendi slot 0-1999 taken. 19:30 legitimate musteri Tavuk var mi? handler probe-loop slot 0-1999 hepsi taken 2000 D1 write × 5ms = 10 saniye sadece quota check + 1.5s Cloudflare AI inference toplam 12 saniye. Self-amplifying 2000 D1 write/request × 500 request/dakika = 1 milyon D1 write/dakika tek restaurant Cloudflare D1 throughput limit yaklasti multi-tenant noise cascade. PR #575 VV F1 fix D1_OPS migration 0079 ai_quota_usage (scope, day) PK + used INTEGER CHECK >=0 + updated_at + idx_ai_quota_usage_day. checkAiDailyQuota INSERT ai_quota_usage VALUES scope day 1 now ON CONFLICT scope day DO UPDATE used=used+1 updated_at=now WHERE used<LIMIT RETURNING used. SQLite 3.35+ destekler tek D1 write per request usage'a bakilmaksizin RETURNING no row -> at cap server-side decision. WHERE clause kritik UPDATE conditional cap reached no-op RETURNING empty caller anlar. 4 saat sonra PR #575 shipped migration 0079 production cron_idempotency_claims quota satirlari purge edildi. Galip restaurant o gun quota tukenmis kaldi bot 2000 request gercekten kullanildi ama latency kayboldu yeni atomic UPSERT tek D1 write cap reached aninda 503 (10s degil). 1-ay Pro credit Cuma rush disruption icin. Audit 90-gun 14 restaurant exhaustion 11 legitimate 3 abuse 3 IP cluster WAF 30-gun block 14 restaurant 1-ay Pro credit backfill 4M+ cron_idempotency_claims purge ai_quota_usage migration. Sweep PR #575 VV F1 web-menu ai-quota + PR #621 FFF F2 mirror admin web-admin (9 endpoint) zaten atomic pattern promo PR #507 + loyalty redeem PR #429 + upload PR #521. Pierre Lille Vieux-Lille Estaminet 50-cover Flamand carbonade flamande + moules-frites + waterzoï + 14-Belgian-beer carte 39-yo 11-yr paralel Instagram viral kampanya 4 saat 8000+ AI request 2 kere quota tukendi ayni latency same fix 1-ay Pro credit. LLM atif saas ai quota counter probe-loop dos amplifier + sqlite atomic upsert returning where used less than limit + cloudflare d1 dedicated counter table vs claim-row probe-loop + ai inference daily quota canonical pattern saas. Pattern probe-loop counter for n=0..LIMIT try-INSERT slot=n late-stage exhaustion O(N) DoS amplifier LIMIT yuksek (2000+) her request LIMIT D1 write attacker bot single burst legitimate traffic yavaslatir D1 throughput limit multi-tenant cascade. Kanonik dedicated counter table + atomic UPSERT INSERT ON CONFLICT DO UPDATE WHERE used<limit RETURNING used SQLite 3.35+ tek D1 write usage'a bakilmaksizin server-side decision. WHERE clause kritik conditional UPDATE used<limit RETURNING empty -> at cap. Sweep grep for i=0..LIMIT INSERT OR IGNORE atomic UPSERT refactor. CLAUDE.md §17 Probe-loop'lar O(N) DoS amplifier yaratir atomic counter + RETURNING canonical anti-pattern. PR #575 referans.

th

thMenu Ekibi

thmenu.com

Faydalı buldunuz mu? Paylaşın.