Performance Analysis and Refactoring of the Synapse Reference Server through Observability - Gomes, Francisco A. A.; Silva, Francisco A.; Sales, Michel; Viana, Windson; Trinta, Fernando A. M.; Andrade, Rossana M. de C.; Macêdo, José A. F. de; Lagrota, Vinícius; Pacheco, Rodrigo; Rego, Paulo A. L. (Anais do Simpósio Brasileiro de Redes de Computadores e Sistemas Distribuídos (SBRC), 2026)
The Matrix protocol is a leading solution for decentralized, real-time communication, with Synapse as its primary reference server. Despite its wide adoption, systematic performance evaluations leveraging observability have been limited. This study instruments Synapse with distributed tracing, metrics collection, and network traffic analysis to characterize endpoint usage, identify bottlenecks, and guide architectural optimization. Our analysis revealed that synchronization, database contention, and lock management are the primary sources of latency, particularly around the /sync and message dispatch endpoints. Guided by observability insights, we applied targeted refactoring, including cache resizing, workload redistribution to specialized workers, baremetal deployment, PostgreSQL tuning, and connection pooling. These interventions transformed Synapse into a highly scalable system, increasing throughput from 11 to 405 requests per second and reducing average response time from 4755 ms to 92 ms. The results demonstrate that observability not only diagnoses performance issues but can directly inform refactoring strategies to achieve substantial operational gains in complex, distributed communication platforms.