Implementing Redis IO Adapter for Improved Scalability and Enhanced Collaboration in Excalidraw Room #360
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.
Overview
This pull request introduces the implementation of a Redis IO Adapter in the Excalidraw collaboration server. The primary goal is to enhance the server's scalability and real-time collaboration capabilities. This note provides an overview of the changes made, the benefits of using Redis IO, and instructions on how to enable the Redis IO Adapter.
Changes Made
Redis IO Adapter Integration: The main addition in this pull request is the integration of the @socket.io/redis-adapter package to enable broadcasting messages across multiple server instances or nodes. This integration leverages Redis as a pub-sub mechanism to efficiently handle real-time communication among clients.
Conditional Setup: To avoid unnecessary complexity, the Redis IO Adapter is enabled based on the SETUP_REDIS_IO_ADAPTER environment variable. If set to "true," the server establishes a connection to the Redis server and configures the Redis IO Adapter.
Enhanced Collaboration: With the Redis IO Adapter in place, the Excalidraw collaboration server gains improved scalability and ensures that real-time updates are broadcasted to all participants in a drawing room. This allows for seamless collaboration between users, even in distributed environments.
Benefits of Redis IO Adapter
Scalability: Redis is an in-memory data store known for its high performance and scalability. By using the Redis IO Adapter, the Excalidraw server can easily handle a large number of concurrent connections and effectively distribute messages across multiple server instances. This ensures a smooth and responsive experience for all users, regardless of the server load.
Real-time Collaboration: Redis's pub-sub mechanism facilitates efficient broadcasting of updates to all clients in a drawing room. When one user makes changes to a drawing, the updates are instantly propagated to all other connected users, enabling real-time collaboration with minimal latency.
Reliability: Redis provides persistence options, which means that even if the server experiences a temporary downtime or restart, the drawing data remains stored in Redis. This ensures data integrity and prevents any loss of collaboration progress.
Distributed Deployment: The Redis IO Adapter is particularly beneficial for applications deployed in a distributed environment, such as cloud-based setups or containerized deployments. It allows multiple instances of the Excalidraw server to communicate seamlessly, ensuring that updates are propagated to all users regardless of which server they are connected to.
How to Enable Redis IO Adapter
The implementation of the Redis IO Adapter significantly improves the Excalidraw collaboration server's performance and real-time collaboration capabilities. This pull request aims to enhance the overall user experience and make Excalidraw Room more robust for large-scale collaborative drawing sessions. Your feedback and suggestions are welcome, and I look forward to your review
Thank you for considering this pull request.