Tips: Calculating Redis and server configuration for collaborative editing
Use the following steps to estimate the application server and Redis cache configuration for the BoldDocServer Docker image. The estimate depends on the values you set in the REDIS_CACHE_CONNECTION_STRING and REDIS_CACHE_SAVE_THRESHOLD environment variables and on how many users edit documents at the same time.
Step 1: Gather the inputs
| Input | Description | How to get it |
|---|---|---|
| Concurrent users (U) | Users editing at the same time, not total registered users. | Analytics or expected peak usage. |
| Active documents (D) | Documents open for collaborative editing at the same time. | U ÷ average users per document. |
| Requests per user (r) | HTTP requests per second triggered by each user’s edits. | Typically 2 to 5. Use 5 for peak sizing. |
| Save threshold (T) | Value of REDIS_CACHE_SAVE_THRESHOLD. |
Minimum recommended value is 100. |
| Redis commands per request (k) | Redis operations performed for each edit request. | Measure in a load test. Use 3 for a first estimate. |
Step 2: Calculate the server configuration
Peak requests per second (RPS) = U × r
Server instances = (RPS ÷ 125) × 1.2 (round up)- 125 is the measured capacity of one instance with 2 vCPUs and 8 GB RAM using a distributed cache.
- The 1.2 factor adds 20% headroom for traffic spikes and for an instance restarting during a deployment.
- Run at least 2 instances behind a load balancer, even for small workloads, so that editing continues if one instance fails.
Step 3: Calculate the Redis memory
Memory per document ≈ 400 KB × (T ÷ 100)
Total Redis memory ≈ D × Memory per document × 2 (content buffer)- A document with a save threshold of 100 needs a minimum of 400 KB.
- The buffer factor of 2 covers images and pasted SFDT content. Increase it if your documents contain many images.
- If high availability (replication) is enabled, Redis Cloud Essentials counts the replica in the plan size. Double the total memory in that case.
Step 4: Calculate the Redis throughput and bandwidth
Peak Redis ops/sec = RPS × k
Monthly bandwidth ≈ Peak Redis ops/sec × 0.3 × average payload size × active seconds per month- Redis Cloud throughput limits assume a 1 KB request size. Operations with images or pasted content are larger, so they consume the limit faster.
- 0.3 assumes average traffic is about 30% of peak. Replace it with your measured value.
- Active seconds per month for 8 hours a day, 22 working days = 8 × 3,600 × 22 = 633,600 seconds.
Step 5: Choose the Redis plan
Choose the smallest plan that satisfies all of the following limits. In collaborative editing, throughput and bandwidth usually decide the plan before memory does.
- Database size ≥ total Redis memory (Step 3).
- Maximum throughput ≥ peak Redis ops/sec (Step 4).
- Monthly network bandwidth ≥ estimated monthly bandwidth (Step 4).
- Concurrent connections ≥ connections opened by all server instances, with headroom.
Example 1: Small team
Inputs: 50 concurrent users, 20 active documents (about 2 or 3 users per document), REDIS_CACHE_SAVE_THRESHOLD = 100.
| Calculation | Result |
|---|---|
| Peak RPS = 50 × 5 | 250 requests/sec |
| Server instances = (250 ÷ 125) × 1.2 = 2.4 | 3 instances (2 vCPUs, 8 GB RAM each) |
| Redis memory = 20 × 400 KB × 2 | 16 MB (32 MB with replication) |
| Peak Redis ops/sec = 250 × 3 | 750 ops/sec |
| Monthly bandwidth = 750 × 0.3 × 1 KB × 633,600 s | ≈ 146 GB |
Example 2: 1,000 concurrent users
Inputs: 1,000 concurrent users, 250 active documents (about 4 users per document), REDIS_CACHE_SAVE_THRESHOLD = 100.
| Calculation | Result |
|---|---|
| Peak RPS = 1,000 × 5 | 5,000 requests/sec |
| Server instances = (5,000 ÷ 125) × 1.2 | 48 instances (2 vCPUs, 8 GB RAM each) |
| Redis memory = 250 × 400 KB × 2 | 200 MB (400 MB with replication) |
| Peak Redis ops/sec = 5,000 × 3 | 15,000 ops/sec |
| Monthly bandwidth = 15,000 × 0.3 × 1 KB × 633,600 s | ≈ 2.9 TB |
Additional tips
- Raising the save threshold increases memory. Up to twice the
REDIS_CACHE_SAVE_THRESHOLDoperations are kept per document, so a threshold of 200 needs about twice the memory of a threshold of 100. Lowering it below 100 saves memory but increases how often the document is saved, which adds load on the server. - Connections come from the server, not the browser. Redis connections are opened by the BoldDocServer instances. Estimate the total as server instances × connections per instance, and keep it well below the plan limit.
- Validate with a load test. Simulate your expected users and monitor
ops/sec,used_memory,connected_clients, and network usage in the Redis Cloud console. Replace the assumed values (k, buffer factor, and 0.3) with your measured values, and recalculate. - Scale horizontally. Add server instances as RPS grows. Because all editing operations are stored in Redis, any instance can serve any user.
- Keep Redis and the servers in the same region to reduce latency between edits and conflict resolution.