Skip to content

perf(presence): reduce heartbeat frequency - #3783

Merged
tlongwell-block merged 2 commits into
mainfrom
perci/presence-minute
Jul 30, 2026
Merged

perf(presence): reduce heartbeat frequency#3783
tlongwell-block merged 2 commits into
mainfrom
perci/presence-minute

Conversation

@tlongwell-block

@tlongwell-block tlongwell-block commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • send desktop presence heartbeats every 60 seconds instead of every 30 seconds
  • extend presence TTL from 90 to 180 seconds to preserve the existing three-heartbeat expiry window
  • add mutation-sensitive tests that pin the one-minute / three-window timing contract
  • update presence documentation to match

This halves steady-state desktop presence SET + PUBLISH traffic while retaining tolerance for two missed heartbeats. Mobile already uses a 60-second heartbeat, so the fleet-wide reduction depends on desktop's share of connected clients.

Rollout order

Deploy the relay TTL increase before shipping the desktop heartbeat change. Old desktop + new relay is safe; new desktop + old relay leaves only a 90-second TTL on a 60-second cadence and can flap after one missed heartbeat.

Verification

At initial live-test commit 00816e233b187bc5ba12c667d675ed050a8cc1c9:

  • isolated clean-room relay built from the exact SHA against fresh Postgres, Redis, and MinIO
  • live Redis MONITOR observed kind-20001 writes as SET ... EX 180, global PUBLISH, and clean-disconnect / explicit-offline DEL
  • normal workflows passed: channel create/update/archive/unarchive; message send/get/reply/thread/search; archived-channel write rejection and resumed write after unarchive

At follow-up commit bf38a8c5c96f196ff8ee46e48d4141ee7811f186:

  • pnpm -C desktop test — 3829 passed
  • pnpm -C desktop typecheck
  • cargo test -p buzz-pubsub — 24 passed, 11 Redis-dependent tests ignored
  • mutation probes fail when the server TTL changes to 999999 or the desktop heartbeat changes back to 30 seconds
  • git diff --check

The pre-push suite's relevant checks passed, but its unrelated Tauri clippy step fails on current origin/main: desktop/src-tauri/src/linux_media.rs has three dead-code warnings on macOS. This PR does not modify that file, so the branch was pushed after independently running the suites above.

Buzz context

Originating channel: buzz-redis-cluster-mode (f4e36d32-afdb-447f-8c87-ab003e069d18)

Send desktop presence heartbeats once per minute and extend the Redis TTL to preserve the existing three-heartbeat expiry window.

Co-authored-by: npub1t2tgm7d8f995uqvmnm8h88sg3wnpp9a5xysjf6dg3tjmgt3ltulqdp8ehr <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@buzz.block.builderlab.xyz>
Signed-off-by: npub1t2tgm7d8f995uqvmnm8h88sg3wnpp9a5xysjf6dg3tjmgt3ltulqdp8ehr <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@buzz.block.builderlab.xyz>
@tlongwell-block
tlongwell-block requested a review from a team as a code owner July 30, 2026 18:19
Co-authored-by: npub1t2tgm7d8f995uqvmnm8h88sg3wnpp9a5xysjf6dg3tjmgt3ltulqdp8ehr <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@buzz.block.builderlab.xyz>
Signed-off-by: npub1t2tgm7d8f995uqvmnm8h88sg3wnpp9a5xysjf6dg3tjmgt3ltulqdp8ehr <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@buzz.block.builderlab.xyz>
@tlongwell-block
tlongwell-block merged commit bf139e8 into main Jul 30, 2026
32 checks passed
@tlongwell-block
tlongwell-block deleted the perci/presence-minute branch July 30, 2026 19:26
joahg added a commit to joahg/buzz-dev-mode that referenced this pull request Jul 30, 2026
…-style

* origin/main:
  feat(desktop): improve agent activity header ui (block#3321)
  perf(presence): reduce heartbeat frequency (block#3783)
  Tighten continuation message rows (block#3724)
  Fix video reviews in thread replies (block#3719)
  feat(release): make desktop releases immutable (block#3568)
  Make relay reconnect backoff authoritative (block#3774)
  feat(desktop): add password-protected backups in settings (block#3701)
  fix(desktop): reuse profiles when joining communities (block#2155)

Signed-off-by: Joah Gerstenberg <joah@squareup.com>
wpfleger96 pushed a commit that referenced this pull request Jul 30, 2026
* origin/main: (29 commits)
  feat(desktop): raise the install ceiling and make installs observable (#3368)
  fix(db): isolate usage metrics advisory-lock test on scratch DB (#3670)
  Add Devin as a preset ACP harness (#3225)
  feat(desktop): improve agent activity header ui (#3321)
  perf(presence): reduce heartbeat frequency (#3783)
  Tighten continuation message rows (#3724)
  Fix video reviews in thread replies (#3719)
  feat(release): make desktop releases immutable (#3568)
  Make relay reconnect backoff authoritative (#3774)
  feat(desktop): add password-protected backups in settings (#3701)
  fix(desktop): reuse profiles when joining communities (#2155)
  Render mobile agent mention chips (#3702)
  fix(catalog): update Amp description (#3758)
  fix(acp): preserve truncated thread context (#3340)
  feat(catalog): resolve publisher display name in catalog detail pane (#3640)
  feat(mesh): upgrade embedded mesh to v0.74 and harden shared compute (split 1/2 of #3467) (#3741)
  docs(nips): specify kind:30621 multi-repo projects (NIP-MP) (#3163)
  Refine agent sharing dialog (#3699)
  desktop: enable getUserMedia in the Linux WebKitGTK webview (#3607)
  fix: align responsive agent views (#3688)
  ...

Signed-off-by: npub1g8493u0xfsjrvflg4n08ezd7vec99mnwzlv0qgwpr9d7gvjwhuzqx59rhw <41ea58f1e64c243627e8acde7c89be667052ee6e17d8f021c1195be4324ebf04@buzz.block.builderlab.xyz>
tellaho pushed a commit that referenced this pull request Jul 30, 2026
* origin/main:
  fix(desktop): allow linux-only media items as dead code off-linux (#3811)
  fix(desktop): report authenticated relay recovery (#3812)
  fix(desktop): don't gate hover affordances on the hover media query (#3657)
  feat(relay): gate kind 30178 team-catalog reads behind the shared tag (#3358)
  test(desktop): click visible thread collapse guide (#3800)
  feat(desktop): raise the install ceiling and make installs observable (#3368)
  fix(db): isolate usage metrics advisory-lock test on scratch DB (#3670)
  Add Devin as a preset ACP harness (#3225)
  feat(desktop): improve agent activity header ui (#3321)
  perf(presence): reduce heartbeat frequency (#3783)
  Tighten continuation message rows (#3724)
  Fix video reviews in thread replies (#3719)
  feat(release): make desktop releases immutable (#3568)
  Make relay reconnect backoff authoritative (#3774)
  feat(desktop): add password-protected backups in settings (#3701)
  fix(desktop): reuse profiles when joining communities (#2155)

Signed-off-by: npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w <52a228d6edf316ec6812ac3c9fc0d696ab59fc7954d77e7be31eedcddf91335b@buzz.block.builderlab.xyz>
brow pushed a commit that referenced this pull request Jul 31, 2026
* origin/main: (70 commits)
  fix(catalog): update Amp tagline (#3806)
  fix(desktop): channel topic and membership metadata cleanup (#3642)
  fix(desktop): align data deletion labels (#2230)
  fix(relay): align NIP-11 max_limit with REQ ceiling (#3635)
  fix(desktop): allow linux-only media items as dead code off-linux (#3811)
  fix(desktop): report authenticated relay recovery (#3812)
  fix(desktop): don't gate hover affordances on the hover media query (#3657)
  feat(relay): gate kind 30178 team-catalog reads behind the shared tag (#3358)
  test(desktop): click visible thread collapse guide (#3800)
  feat(desktop): raise the install ceiling and make installs observable (#3368)
  fix(db): isolate usage metrics advisory-lock test on scratch DB (#3670)
  Add Devin as a preset ACP harness (#3225)
  feat(desktop): improve agent activity header ui (#3321)
  perf(presence): reduce heartbeat frequency (#3783)
  Tighten continuation message rows (#3724)
  Fix video reviews in thread replies (#3719)
  feat(release): make desktop releases immutable (#3568)
  Make relay reconnect backoff authoritative (#3774)
  feat(desktop): add password-protected backups in settings (#3701)
  fix(desktop): reuse profiles when joining communities (#2155)
  ...

Signed-off-by: npub15w828kxsxu2684ynste0uah2jwkgatd99flt7ds4523hzm8ju6cshdr8hh <a38ea3d8d03715a3d49382f2fe76ea93ac8eada52a7ebf3615a2a3716cf2e6b1@buzz.block.builderlab.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant