Comments (12)
Yep, badger or bolt with raft leader election is an interesting thing to extend current possibilities.
The hardest part of making engine exported at this time is the fact that publish into PUB/SUB should be atomic with saving message to history cache. So publish operation in a whole can be atomic. This works with Redis (to certain degree though, I suppose atomicity of Redis LUA scripts could be not guaranteed when PUB/SUB operations involved), also in Memory engine. But if we split engine on PUB/SUB part and storage part we lose this atomicity. In this case message can be published to current subscribers but not saved in cache, or saved in cache but not published to subscribers. Currently I don't know what should we do in case of these errors at publish time.
Redis has no sync replication so there is a chance to lose messages even with AOF with fsync on every query when master goes down and last messages not achieved slave yet. Having nature of Redis in mind current Redis engine implementation can only be best effort mechanism to provide message persistence for later recovery process. It will work in practice for most real-world apps but there are no strong guarantees as far as I understand.
from centrifuge.
Guys, just want to update status on this. I remember about this issue but the task is not straightforward. I have some ideas but they ruin under various edge cases. At moment I am in progress of validating new idea - maybe it will fit fine but can't be sure.
At least I proved that I can make current engines separate if neseccary. Also played a bit with custom Nats engine which implements only PUB/SUB logic without any persistence layer.
from centrifuge.
Hello, my plan is making internal engine parts pluggable in the end. Though I am not sure about correct implementation and currently concentrated on finishing work on Centrifugo v2 built on top of this lib.
I don't fully understand your intents - this library should only persist a short-term cache of messages. What is your use case for persistent store? Are you going to keep unlimited amount of messages in it? Also Redis Pub/Sub is not currently used for persistence - it is used for Centrifuge node scalability.
from centrifuge.
Great, I'm glad to hear that's on the roadmap.
My use case for persistence is to have a cache that can survive reboots, while ideally using something a little simpler than Redis but that can still provide simple kv lookups (like Bolt for example). Otherwise I would just load a log file into memory when the app comes back online. I'm using Centrifuge to pass messages and data from a local daemon/server to a local gui client, local daemon to remote client, or remote daemon/server to local daemon/server.
from centrifuge.
Badger or bolt with raft leader election should be enough to get HA.
I think redis is HA in that you can specify how often it syncs to disk ?
from centrifuge.
from centrifuge.
@gedw99 thanks for suggestions. Centrifuge lib in its current state is very close to event sourcing system. At least this is already kind of. Its hard to say at moment in what direction we should expand it - maybe the understanding will come with usage reports if any:)
from centrifuge.
I guess it's also because your relying on redis to do the hard stuff which is totally understandable.
You could use emitter golang project instead of redis. Then you can wrap it. It uses mqtt as the messaging layer and supports scaling honizontally
from centrifuge.
maybe can use mongodb instead of redis
from centrifuge.
@stemcc please take a look at referenced pull request where I am trying to split Engine on three parts - Broker, HistoryManager and PresenceManager. This is a road to pluggable components, hope this will allow to do more with this library. At least look at interesting concept example where Nats used for PUB/SUB and Redis for other stuff.
from centrifuge.
Let's reopen until it will be documented
from centrifuge.
Just posted a note about pluggable components on Medium, also we have an example of setting custom broker implementation. I suppose this is enough for a moment. If there are any questions about current implementation - feel free to ask.
from centrifuge.
Related Issues (20)
- ServerJoin event not sent HOT 4
- client.send(data) disconnects clients on empty data HOT 2
- Occasional data race in `initMetricsRegistry` HOT 1
- Clients being disconnected due to "Slow" reason - throttling options HOT 14
- Redis broker pool size HOT 4
- KeyDB connect HOT 3
- private channel HOT 2
- Deprecated ProtocolVersion1 will be removed soon HOT 1
- Client level heartbeat config HOT 7
- Custom recover at connection level HOT 4
- High memory consumption HOT 7
- Apply suggestions from fieldalignment for frequently used objects HOT 1
- Making send call to return a reply HOT 1
- Publish() causes a runtime error when no client subscribed to then channel. HOT 2
- [feature] presence with massive amount of active users HOT 6
- Remove SockJS transport HOT 1
- Embed Gorilla WebSocket HOT 1
- How Many Concurrent RPC Requests can server handle? HOT 2
- [feature] Return error when publishing with incorrect history TTL + history meta TTL configuration
- [bug] Investigate occasional panic in tests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from centrifuge.