Everything is at radekmie.dev.
(Slides for this presentation too.)
Client
Server
MongoDB
MongoDB
1. method
4. added
2. insert
3. oplog
DDP
Client
Server
MongoDB
1. method
5. added
2. insert
3. publish
DDP
MongoDB
Redis
Redis
4. subscribe
Client
Server
MongoDB
1. method
6. added
2. insert
DDP
MongoDB
Redis
Redis
changestream-to-redis
3. subscribe
4. publish
5. subscribe
Client
Server
MongoDB
1. method
5. added
3. insert
DDP
MongoDB
4. subscribe
DDP Router
2. method
Processes only published collections
Oplog
Redis Oplog
DDP Router
⚠️
✅
✅
See oplogExcludeCollections
and oplogIncludeCollections
for a way to manually select what to process and what to skip.
Processes only published collections
Processes only published documents
Oplog
Redis Oplog
DDP Router
⚠️
✅
✅
❌
❌
⚠️
See "On Optimizing Meteor Publications" to learn how changestream-to-redis can use custom channels.
Processes only published collections
Processes only published documents
Refetches full documents more often than you would think
Oplog
Redis Oplog
DDP Router
⚠️
✅
✅
❌
❌
⚠️
🔥
🔥
🔥
All the diagrams are missing one crucial
operation: fetching data from MongoDB.
Both oplog- and Redis-based observe drivers can handle only some operations directly. Everything else requires a full refetch.
It can be mitigated by using protectAgainstRaceConditions.
It may be worse with large documents.
users.find({}, { limit: 3, sort: { score: -1 }, })
User X (score: 42)
User Y (score: 37)
User Z (score: 21)
Scenario 1
User A (score: 69)
User should be added
to the result set.
✅
Scenario 2
User X (score: 1)
User should be removed
from the result set.
🔥