Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing Redis IO Adapter for Improved Scalability and Enhanced Collaboration in Excalidraw Room #360

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GathsaraH
Copy link

@GathsaraH GathsaraH commented Aug 6, 2023

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

  1. 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.

  2. 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.

  3. 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.

  4. 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

Ensure that you have a Redis server up and running, either locally or on a remote host. You can find instructions on how to install and run Redis from the official Redis website (https://redis.io/).

Clone the Excalidraw Room repository from the provided GitHub link: https://github.com/excalidraw/excalidraw-room

Install the required dependencies using npm or yarn

Create a .env file in the root of the project and set the following environment variables:

PORT=<port_number>
CORS_ORIGIN=<allowed_cors_origin>
SETUP_REDIS_IO_ADAPTER=true
REDIS_HOST=<redis_server_url>

Replace <port_number> with the desired port for the server to listen on, <allowed_cors_origin> with the allowed origin for CORS, and <redis_server_url> with the URL of your running Redis server.

Start the server

With the Redis IO Adapter enabled the Excalidraw collaboration server is now ready to provide enhanced scalability and real-time collaboration capabilities to all connected users.

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.

@GathsaraH GathsaraH changed the title Implementing Redis IO Adapter for Improved Scalability and Enhanced Collaboration in Excalidraw Room Overview Implementing Redis IO Adapter for Improved Scalability and Enhanced Collaboration in Excalidraw Room Aug 6, 2023
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.

None yet

1 participant