Architecture and performance review: Short-polling collaborative editing implementation#74398
Closed
Copilot wants to merge 1 commit into
Closed
Architecture and performance review: Short-polling collaborative editing implementation#74398Copilot wants to merge 1 commit into
Copilot wants to merge 1 commit into
Conversation
Copilot
AI
changed the title
[WIP] Update long-polling POC to use short-polling and post meta
Architecture and performance review: Short-polling collaborative editing implementation
Jan 7, 2026
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.
Completed architectural and performance analysis of the transition from long-polling/SSE to short-polling with post meta storage for collaborative editing sync.
Findings
Critical Performance Issues
No message cleanup: Messages accumulate indefinitely in
wp_postmetawithout expiration. Active editing sessions will create thousands of rows with no garbage collection.Aggressive polling interval: 200ms polling (5 req/sec per client) causes excessive database load. 10 concurrent editors = 50 queries/sec continuously.
Inefficient message retrieval:
get_new_messages()fetches all messages viaget_post_meta()then filters in PHP. Does not leverage database-level filtering.Singleton post bottleneck: All rooms share one post for storage, creating cache invalidation churn and database lock contention on every write.
No error backoff: Failed polling requests retry at full speed (200ms) with no exponential backoff.
Architecture Concerns
Storage model mismatch: Using
add_post_meta(..., false)creates separate rows per message. Linear row growth without bounds.Race conditions: Non-atomic message ID generation during concurrent writes.
Client-side issues: No Page Visibility API support, thundering herd on initial page load, continuous battery drain.
Recommended Fixes (Priority Order)
Positive Aspects
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.