A full re-implementation of the Meteor's MongoDB oplog tailing. This time, reactivity is controlled by the app, opening a new world into building reactive applications, highly scalable chat apps, games, and added reactivity for non-persistent data.
Incrementally adoptable & works with your current Meteor project.
This package uses ioredis
as its Redis client which has full support of Redis including Sentinel. Thanks to that you
can achieve high availability of Redis cluster and configure connection to your needs.
meteor add megawebmaster:redis-oplog
IMPORTANT!
To make sure it is compatible with other packages which extend the
Mongo.Collection
methods, make sure you go to.meteor/packages
and putmegawebmaster:redis-oplog
as the first option.
Configure it via Meteor settings:
// settings.json
{
...
"redisOplog": {}
}
// default full configuration
{
...
"redisOplog": {
"redis": {
"port": 6379, // Redis port
"host": "127.0.0.1" // Redis host
},
"retryIntervalMs": 10000, // Retries in 10 seconds to reconnect to redis if the connection failed
"mutationDefaults": {
"optimistic": true, // Does not do a sync processing on the diffs. But it works by default with client-side mutations.
"pushToRedis": true // Pushes to redis the changes by default
},
"debug": false, // Will show timestamp and activity of redis-oplog.
}
}
To see what you can configure under "redis": {}
take a look here:
https://github.com/luin/ioredis#connect-to-redis
meteor run --settings settings.json
RedisOplog is fully backwards compatible, so there won't be any change in how you use Meteor, unless you want to fine-tune your application for absolute performance.
RedisOplog does not work with insecure package, which is used for bootstrapping your app.
Also make sure that your production system does not generate MONGO_OPLOG_URL
to disable MongoDB Oplog tailing.
If you need to forcibly disable it please run meteor add disable-oplog
.
If you are interested in viewing how many observers are registered or memory consumption:
meteor shell
import { RedisOplog } from 'meteor/megawebmaster:redis-oplog';
// works only server-side
RedisOplog.stats()
- Just add RedisOplog, you will already see big performance improvements
- Fine-tune your reactivity by using custom namespaces and channels
- Implement your own custom reactivity by using Redis Vent
If you are using Optimistic UI (Latency Compensation) in your application, you should give this a read.
Find out what RedisOplog does behind the scenes
Find out how you can use the advantages of Redis Oplog to make your app very performant.
Find out how you can hook into redis events to customize, when it fails.
Find out how you can customize your reactivity and enable it across multiple languages/microservices with ease.
If you have different workers/services that perform updates to mongo and they exist outside Meteor, you can still trigger reactivity for the Meteor instances with a few lines of code.