Repository navigation
feat(negotiation): switch event formats once every subscriber can read them - #415
Open
cosmin-staicu wants to merge 1 commit into
Open
cosmin-staicu wants to merge 1 commit into
cosmin-staicu wants to merge 1 commit into
Conversation
cosmin-staicu
requested review from
alinahornet,
florin-munteanu-uipath,
litheon,
lucianaparaschivei and
razvalex
as code owners
November 12, 2026 14:39
|
🔎 Maintainer heads-up: automated triage flagged this PR as potentially material, so it may need a signed CLA in addition to the DCO sign-off. Strong signals
Other signals
This is advisory only — the bot does not decide. Please judge against the CLA criteria (material, product-critical, patent-sensitive, corporate contributor, broad commercial use). Note that thresholds can be gamed by splitting PRs, so use your judgement.
|
cosmin-staicu
force-pushed
the
perf/format-negotiation
branch
from
November 13, 2026 13:39
252edb9 to
d5d8a19
Compare
cosmin-staicu
force-pushed
the
perf/event-format-negotiation
branch
from
November 13, 2026 13:39
42ea5b0 to
cb75a10
Compare
cosmin-staicu
force-pushed
the
perf/format-negotiation
branch
2 times, most recently
from
November 14, 2026 07:47
3c4c09c to
19fd942
Compare
cosmin-staicu
force-pushed
the
perf/event-format-negotiation
branch
from
November 14, 2026 08:18
cb75a10 to
32d0840
Compare
…d them Binary events now switch the way values do, and Pub/Sub deployments can be seen, so they switch too. With AddMessagePackEvents(write: true), each node lists the event formats it decodes in its advertisement. Binary events are written once every advertisement lists 02, no live node is unaccounted for and UpgradeHold has passed. A node that lists only json, or an unaccounted node, sends events back to JSON at once. Write false always writes JSON, Mode = Force writes binary at once, the decoder always reads both formats, and with no Redis connection events stay JSON unless AssumeAllNodesCanRead or Force is set. Values and events are decided apart. Pub/Sub has no consumer groups, so subscribers are counted. The live count is the sum of PUBSUB NUMSUB over every server, primaries and replicas, and the accounted count is the sum of the subscriptions that live advertisements claim. A node claims a subscription only after the server confirms it, and advertises at once. Patterns are counted with PUBSUB NUMPAT and advertised as psub, and more patterns than claimed is an unknown subscriber. More live than accounted for two views in a row is an unknown subscriber, and fewer is a departed node whose advertisement outlives it. Both fall back to JSON, and a departure does not restart the hold. A server the node knows about but is not connected to fails the whole view, and a refused NUMSUB is unknown, so the format stays JSON unless AssumeAllNodesCanRead is set. An upgrade needs two clean views over the same number of servers, and a one-view blip only pauses a hold in progress. The event formatter reads one volatile reference and the injected clock, with no Redis call on the hot path, and an app that registers nothing gets no wrapper, timer or key. There are no new options. The Caching.Stats.FormatBlockers metric names who blocks, as node ids or Pub/Sub channels, only when the set changes. cache.format.effective and cache.format.fallback gain a kind tag with value or event, plus the reasons unaccounted_subscriber and subscriber_deficit. Signed-off-by: Cosmin Staicu <cosmin.staicu@uipath.com>
cosmin-staicu
force-pushed
the
perf/event-format-negotiation
branch
from
November 14, 2026 09:02
32d0840 to
87600a7
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Seventh in the fast value serializer stack, on top of #413. Binary events switch the way values do, and Pub/Sub deployments can be seen, so they switch too.
Values and events are decided apart. A node with the decoder and no value serializer advertises and decides too. An app that registers nothing is unchanged: no wrapper, no timer, no key.
No new options. New: the
Caching.Stats.FormatBlockersmetric, which names who blocks (node ids or Pub/Sub channels), only when the set changes, and not on the boundedcache.format.*metrics.cache.format.effectiveandcache.format.fallbackgain akindtag (valueorevent) and the reasonsunaccounted_subscriberandsubscriber_deficit; node ids never go into a tag. The "deploy 1 / deploy 2" text for events is gone from the docs.Evidence
The JSON default path allocates what feat(negotiation): switch the value format once every node can read it #413 allocates.
SerializerBenchmark, B, Small and Medium,Registered=False, the same forRegistered=True:Large differs by under 0.03% in both directions (LOH arrays, short job).
With nothing registered the event formatter is the plain one, and encoding allocates what the default formatter allocates (a test). Through the negotiated wrapper it allocates what a fixed wrapper does.
Real Redis:
Mutations caught (50): events ignoring
er; "any" instead of "every"; no hold for events; groups ignored for events; the composite deciding once;Forceignored;write: falseasking the node list;NUMSUBon one server only; a surplus counted at the first view; an upgrade on one clean view; the server count ignored; a refusedNUMSUBread as zero; a failed read keeping the debounce; claiming channels, not confirmed subscriptions; no immediate advertisement after a confirmation; a node that left still claiming; a deficit not blocking, counted at the first view, restarting the hold, or clearing as clean; a join during a deficit not restarting the hold; no node list writing binary, ignoring the attestation, or ignoringForce; a departing ad with no subscriptions; a leaving claim required or not optional; a blip restarting the hold; a deficit cleared by a fresh claim not a join; no reset after a failed or empty view; a refusedNUMSUBnot logged; advertisements not serialized, written after the departing one, or not waited for by a stop; more than one command per server; a pattern or sharded channel counted; the debounce not per channel; an empty policy tag; a disconnected server left out of the sum; patterns not counted, not claimed, not advertised or not read from the server; fewer patterns than claimed as a deficit; the channel prefix not applied.Tests that expect binary events through the container set
Mode = Force, sinceAutowrites JSON until the hold passes.Full suite with Redis: 5253, 0 failed, 1 skipped (a pre-Redis-7 case on Redis 7.4).
-c Release -warnaserrorbuilds clean.Merge Danger
Door: two-way
Apps that already write binary events now write JSON until every node advertises the decoder and the hold passes, or until they set
Mode = Force; an app with no Redis connection writes JSON unless it setsAssumeAllNodesCanReadorForce. All 3.2 nodes read both formats, so either way is safe. A Pub/Sub app whose Redis refusesPUBSUB NUMSUBstays on JSON unlessAssumeAllNodesCanReadis set.Blast Radius: storage
The wire format of events on the topics of apps that set
write: true, the value format on Pub/Sub deployments (now able to switch), and one advertisement per node now lists its subscriptions.