feat(syncapi): implement MSC4186 Simplified Sliding Sync#1
Open
lmendes86 wants to merge 8 commits into
Open
Conversation
Implement Phase 1 of the Dendrite PoC for VoIPGrid migration:
- Add nl.voys.single_user login type that validates tokens against
an external SSO endpoint and auto-provisions user accounts
- Add POST /_synapse/admin/v1/join/{roomID} for admin room joins
- Add POST /_synapse/admin/v1/rooms/{roomID}/make_room_admin
- Add GET /_synapse/admin/v1/rooms/{roomID}/members
- Add POST /_synapse/admin/v1/deactivate/{userID}
- Add DELETE /_synapse/admin/v2/rooms/{roomID}
These endpoints are required by room-service, matrix-sso, and
matrix-nats-bridge to operate against a Dendrite homeserver.
Signed-off-by: Lucas <lucas@voipgrid.nl>
🗿 MoAI <email@mo.ai.kr>
Signed-off-by: Lucas Mendes <lucas.mendes@wearespindle.com>
- Document voys_sso_url in dendrite-sample.yaml for nl.voys.single_user login - Add dendrite-benchmark tool for room creation, sync, and admin API perf testing Signed-off-by: Lucas <lucas@voipgrid.nl> 🗿 MoAI <email@mo.ai.kr>
One-command benchmark: ./benchmark/run.sh - Spins up Dendrite + PostgreSQL via docker-compose - Creates admin user, runs room creation / sync / admin API benchmarks - Saves results to benchmark/results.txt - Configurable via --rooms, --users, --concurrent flags Signed-off-by: Lucas <lucas@voipgrid.nl> 🗿 MoAI <email@mo.ai.kr>
AdminJoinRoom now handles invite-only rooms by finding an existing room member to send an invite on behalf of, then retrying the join. Previously it returned 403 because PerformJoin respects join rules. Benchmark tool fixed to use consistent password pattern and try login before registration for idempotent reruns. Signed-off-by: Lucas <lucas@dendrite.dev> 🗿 MoAI <email@mo.ai.kr>
New -scale-test flag creates 10000 rooms concurrently, then progressively joins a single user measuring latency at each tier (10, 100, 1000, 10000 rooms). Also measures sync latency at each checkpoint to show how /sync degrades with room count. Signed-off-by: Lucas <lucas@dendrite.dev> 🗿 MoAI <email@mo.ai.kr>
Phase 3 measures admin join performance at different concurrency levels (1, 5, 10, 20, 50 workers) with 1000 rooms per test. Results show ~1200 joins/sec peak throughput at concurrency 20-50. 🗿 MoAI <email@mo.ai.kr>
Add native MSC4186 Simplified Sliding Sync support to Dendrite's SyncAPI, eliminating the need for the deprecated external sliding-sync proxy. New package syncapi/slidingsync/ implements the full protocol: - Request/response types matching MSC4186 JSON schema - Connection manager with database-backed state persistence - Per-connection state tracker with snapshot/restore serialisation - Room list engine with recency sorting and MSC4186 filters (is_dm, is_encrypted, room_types, not_room_types) - Room subscription handler with list/subscription config merging - Sliding window operations (SYNC, INSERT, DELETE, INVALIDATE) - Delta computation for incremental sync updates - Extension dispatcher for e2ee, to-device, typing, receipts, account_data, and presence via interface-based dependency injection - HTTP handler at POST /_matrix/client/unstable/org.matrix.simplified_msc3575/sync Storage layer adds sliding_sync_connections table with both PostgreSQL and SQLite implementations following existing dual-database patterns. Configuration adds sliding_sync section to sync_api with enabled, connection_ttl, and max_connections fields (defaults: enabled=true, ttl=30m, max_connections=1000). Includes 147 test cases and 12 benchmarks covering all components. Handler initial sync round-trip benchmarks at ~5.5us per request. Ref: SPEC-SLIDINGSYNC-003 Signed-off-by: Lucas Mendes <lucas@voipgrid.nl> 🗿 MoAI <email@mo.ai.kr> Signed-off-by: Lucas Mendes <lucas.mendes@wearespindle.com>
Extend the benchmark tool with incremental sync, sliding sync HTTP, message send (sequential + concurrent), mixed workload, pprof profiling, JSON output, and automated Go/No-Go report generation with threshold evaluation for the VoIPGrid PoC decision. SPEC: SPEC-BENCHMARK-001 🗿 MoAI <email@mo.ai.kr>
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
syncapi/slidingsync/package with complete protocol supportWhat's included
Core protocol
Extensions (6)
Infrastructure
POST /_matrix/client/unstable/org.matrix.simplified_msc3575/syncsliding_sync_connectionstable (PostgreSQL + SQLite dual-implementation)sliding_sync.enabled,connection_ttl,max_connectionsTest plan
go build ./...cleango vet ./syncapi/slidingsync/...clean--raceflag)Files changed
syncapi/slidingsync/(types, connstate, connmanager, roomlist, roomsubscription,sliding_window, delta, extensions, handler + tests)
Benchmark results (i9-13900H)
Ref: SPEC-SLIDINGSYNC-003