From ecb2044bf138b35bfc7ea09fc3a45f6d01a31644 Mon Sep 17 00:00:00 2001 From: Vladimir Rogojin Date: Fri, 29 May 2026 13:29:58 +0200 Subject: [PATCH] config(sidecar): bump SIDECAR_CACHE_MAX_ENTRIES 10k -> 100k (closes #13) Live measurement on unicity-ipfs1.dyndns.org showed the instant-pin cache saturated at 9,995/10,000 entries while only using 90 MB of its 1 GiB byte budget. The entry-count cap was the binding constraint, producing ~33,405 GET /sidecar/blob 404s per 6 h and a 3.3 % hit rate. Bumps the default in all three places: instant_pin_cache.DEFAULT_MAX_ENTRIES, Dockerfile ENV, and docker-compose.yml. README entry-cap row updated. The existing 1 GiB SIDECAR_CACHE_MAX_BYTES cap still bounds memory/disk footprint -- worst case ~9 KB avg/entry * 100k = ~900 MB, well within budget. LRU eviction of in-kubo rows + 503 back-pressure on pending-only saturation are unchanged. No cache-semantics changes. --- Dockerfile | 2 +- README.md | 2 +- docker-compose.yml | 2 +- nostr-pinner/instant_pin_cache.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index d71e77b..5ef15db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -103,7 +103,7 @@ ENV DOMAIN=localhost \ SIDECAR_CACHE_ENABLED="true" \ SIDECAR_CACHE_DIR="/data/ipfs/sidecar-cache" \ SIDECAR_CACHE_MAX_BYTES="1073741824" \ - SIDECAR_CACHE_MAX_ENTRIES="10000" \ + SIDECAR_CACHE_MAX_ENTRIES="100000" \ SIDECAR_CACHE_MAX_BLOB_BYTES="33554432" \ SIDECAR_CACHE_RECONCILE_INTERVAL="5" \ SIDECAR_CACHE_PROMOTION_TIMEOUT="86400" \ diff --git a/README.md b/README.md index 3af56c1..9a51200 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,7 @@ sphere-sdk integration tests (see issue | `SIDECAR_CACHE_ENABLED` | `true` | Kill switch — set to `false` to skip schema migration and disable all `/sidecar/*` endpoints | | `SIDECAR_CACHE_DIR` | `/data/ipfs/sidecar-cache` | Directory for blob bytes (auto-created) | | `SIDECAR_CACHE_MAX_BYTES` | `1073741824` (1 GiB) | Total cache budget across pending + in-kubo rows | -| `SIDECAR_CACHE_MAX_ENTRIES` | `10000` | Entry cap (whichever cap hits first) | +| `SIDECAR_CACHE_MAX_ENTRIES` | `100000` | Entry cap (whichever cap hits first) | | `SIDECAR_CACHE_MAX_BLOB_BYTES` | `33554432` (32 MiB) | Per-submission size limit; oversize returns HTTP 413 | | `SIDECAR_CACHE_RECONCILE_INTERVAL` | `5` | Seconds between reconciler iterations | | `SIDECAR_CACHE_PROMOTION_TIMEOUT` | `86400` (24 h) | Pending rows older than this trigger operator WARN logs (never silently aged out) | diff --git a/docker-compose.yml b/docker-compose.yml index 83153bb..13fd5fe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -69,7 +69,7 @@ services: - SIDECAR_CACHE_ENABLED=${SIDECAR_CACHE_ENABLED:-true} - SIDECAR_CACHE_DIR=${SIDECAR_CACHE_DIR:-/data/ipfs/sidecar-cache} - SIDECAR_CACHE_MAX_BYTES=${SIDECAR_CACHE_MAX_BYTES:-1073741824} - - SIDECAR_CACHE_MAX_ENTRIES=${SIDECAR_CACHE_MAX_ENTRIES:-10000} + - SIDECAR_CACHE_MAX_ENTRIES=${SIDECAR_CACHE_MAX_ENTRIES:-100000} - SIDECAR_CACHE_MAX_BLOB_BYTES=${SIDECAR_CACHE_MAX_BLOB_BYTES:-33554432} - SIDECAR_CACHE_RECONCILE_INTERVAL=${SIDECAR_CACHE_RECONCILE_INTERVAL:-5} - SIDECAR_CACHE_PROMOTION_TIMEOUT=${SIDECAR_CACHE_PROMOTION_TIMEOUT:-86400} diff --git a/nostr-pinner/instant_pin_cache.py b/nostr-pinner/instant_pin_cache.py index 79c01a0..02ffd99 100644 --- a/nostr-pinner/instant_pin_cache.py +++ b/nostr-pinner/instant_pin_cache.py @@ -24,7 +24,7 @@ Capacity / back-pressure ------------------------ The cache is bounded by total bytes (SIDECAR_CACHE_MAX_BYTES, default 1 GiB) -AND entry count (SIDECAR_CACHE_MAX_ENTRIES, default 10_000). When full: +AND entry count (SIDECAR_CACHE_MAX_ENTRIES, default 100_000). When full: * If there is room to evict already-confirmed (`in-kubo`) entries, evict LRU. * If only `pending` entries remain, refuse the new submit with HTTP 503 so @@ -58,7 +58,7 @@ DEFAULT_CACHE_DIR = "/data/ipfs/sidecar-cache" DEFAULT_MAX_BYTES = 1 * 1024 * 1024 * 1024 # 1 GiB -DEFAULT_MAX_ENTRIES = 10_000 +DEFAULT_MAX_ENTRIES = 100_000 DEFAULT_RECONCILE_INTERVAL = 5 # seconds DEFAULT_PROMOTION_TIMEOUT = 24 * 60 * 60 # 24h alert threshold DEFAULT_KUBO_PIN_TIMEOUT = 30 # seconds; per-promotion call cap