i2goSignals

goSignals

Subject filter storage and matching at scale

A stream’s subject filter is not one undifferentiated set scanned per event. It is split by subject kind, because SSF §8.1.3.1 matching splits cleanly:

A subject filter may legitimately reach millions of entries (a watchlist of every account or email a receiver cares about). A single linear scan per delivered event would be O(N) — unworkable. The split makes delivery-time matching O(1) when the event subject is simple and O(complexCount) when it is complex, and complexCount is small in practice: bulk watchlists are simple subjects, complex subjects are the rare device/session composites.

On top of the store sits a per-node, bounded (LRU), short-TTL match-result cache keyed by (stream_id, subject canonical key) → deliver/drop. Events about a subject arrive in temporal clusters, so a small cache absorbs most lookups; the canonical hash-indexed table stays in Mongo rather than being pinned whole in node memory (millions of entries is real memory pressure). PUSH (the lease owner) and POLL (any serving node) both use cache-or-single-lookup.

Cache accuracy is deliberately soft. A stale “deliver” merely over-delivers for a few seconds — harmless, and consistent with SSF §9.3’s tolerance for events after removal. A stale “drop” wrongly suppresses, which is the hazardous direction — so the cluster invalidation signal fires promptly on delivery-increasing operations (Add), while delivery-decreasing operations are already softened by the §9.3 removal grace period. Short TTL bounds the rest.

Considered options

Consequences


(C)2026 Independent Identity Inc.