Several Ninlil instances can share an optional ValKey server for cache expiry, the live feed, rate limits and forwarded answers #69

Open
opened 2026-10-31 12:42:00 -04:00 by claude · 0 comments
Owner
  • Draft: INT-1
  • Priority: high (the owner put ValKey first after the release, 2026-10-09)
  • Agent: none (epic)
  • Depends on: none
  • Decisions: Q-INT-3, Q-INT-4, Q-INT-5

Why

Every cache in Ninlil lives in one process. IEntityChangeNotifier reports local writes only (src/dotnet/src/Ninlil.Dns.Data.Abstractions/Repository/IEntityChangeNotifier.cs:11-12). So when instances share one database, an instance sees another instance's write only when its cache times out. That is 60 s for the client directory, filter configuration, rewrites, schedules and forwarder zones, and 5 min for filter-list entries (README.md:5092-5098). The zone and access-rule caches have no timer at all today (README.md:5098); #50 gives them the same 60 s bound without ValKey. The DNS rate limiter keeps all its state in memory per node (src/dotnet/src/Ninlil.Dns.Server.RateLimiting/TokenBucketDnsRateLimiter.cs:29-31, src/dotnet/src/Ninlil.Dns.Server.Core/RateLimiting/IDnsRateLimiter.cs:9-11), and so does the admin sign-in limiter (src/dotnet/src/Ninlil.Dns.Identity/Extension/ServiceCollectionAdminLoginRateLimitingExtension.cs:79-127). The forwarded-answer cache is per process too (src/dotnet/src/Ninlil.Dns.Server.Forwarding/Caching/ForwardedResponseCache.cs:44). SignalR has no backplane (src/dotnet/src/Ninlil.Web/Program.cs:689-695).

ValKey is optional. It is never a source of truth: if it is missing or down, every feature falls back to the node-local behaviour of today. A single node never benefits, because the in-process caches are faster.

What changes

Children, in order:

  • #70: connection, options, health check, test host
  • #71: cross-node cache expiry over pub/sub
  • #72: SignalR backplane
  • #73: shared DNS rate-limit counters
  • #74: shared admin sign-in rate-limit counters
  • #75: shared forwarded-answer cache
  • #76: docs and the docker-compose service

Acceptance

  • All children closed.
  • ENVIRONMENT.md lists every new NINLIL_VALKEY_* variable, with recounted totals.
  • README has a ValKey section.

Source

  • Owner decision 2026-10-09 (memory project_first_release_plan.md): ValKey and then AD/Samba DNS right after the release.
  • b11-12-design.md §2.8 (B11-12i change notifier) and line 641 (ValKey named as the cross-node follow-up).
  • Owner decision 2026-10-31 (Q-INT-3): "DNS queries AND admin login limiter" (new child #74).
  • Owner decision 2026-10-31 (Q-INT-5): "60 s TTL backstop now, as a post-release-fixes issue" (#50).
- **Draft:** INT-1 - **Priority:** high (the owner put ValKey first after the release, 2026-10-09) - **Agent:** none (epic) - **Depends on:** none - **Decisions:** Q-INT-3, Q-INT-4, Q-INT-5 ### Why Every cache in Ninlil lives in one process. `IEntityChangeNotifier` reports local writes only (`src/dotnet/src/Ninlil.Dns.Data.Abstractions/Repository/IEntityChangeNotifier.cs:11-12`). So when instances share one database, an instance sees another instance's write only when its cache times out. That is 60 s for the client directory, filter configuration, rewrites, schedules and forwarder zones, and 5 min for filter-list entries (README.md:5092-5098). The zone and access-rule caches have no timer at all today (README.md:5098); #50 gives them the same 60 s bound without ValKey. The DNS rate limiter keeps all its state in memory per node (`src/dotnet/src/Ninlil.Dns.Server.RateLimiting/TokenBucketDnsRateLimiter.cs:29-31`, `src/dotnet/src/Ninlil.Dns.Server.Core/RateLimiting/IDnsRateLimiter.cs:9-11`), and so does the admin sign-in limiter (`src/dotnet/src/Ninlil.Dns.Identity/Extension/ServiceCollectionAdminLoginRateLimitingExtension.cs:79-127`). The forwarded-answer cache is per process too (`src/dotnet/src/Ninlil.Dns.Server.Forwarding/Caching/ForwardedResponseCache.cs:44`). SignalR has no backplane (`src/dotnet/src/Ninlil.Web/Program.cs:689-695`). ValKey is optional. It is never a source of truth: if it is missing or down, every feature falls back to the node-local behaviour of today. A single node never benefits, because the in-process caches are faster. ### What changes Children, in order: - #70: connection, options, health check, test host - #71: cross-node cache expiry over pub/sub - #72: SignalR backplane - #73: shared DNS rate-limit counters - #74: shared admin sign-in rate-limit counters - #75: shared forwarded-answer cache - #76: docs and the docker-compose service ### Acceptance - [ ] All children closed. - [ ] `ENVIRONMENT.md` lists every new `NINLIL_VALKEY_*` variable, with recounted totals. - [ ] README has a ValKey section. ### Source - Owner decision 2026-10-09 (memory `project_first_release_plan.md`): ValKey and then AD/Samba DNS right after the release. - `b11-12-design.md` §2.8 (B11-12i change notifier) and line 641 (ValKey named as the cross-node follow-up). - Owner decision 2026-10-31 (Q-INT-3): "DNS queries AND admin login limiter" (new child #74). - Owner decision 2026-10-31 (Q-INT-5): "60 s TTL backstop now, as a post-release-fixes issue" (#50).
claude added this to the Release: ValKey milestone 2026-10-31 12:42:00 -04:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
lantea-one/ninlil#69
No description provided.