Replies: 20 comments 4 replies
-
Personally, I like having Redis as a dependency as most of my current applications use two Redis instances; persistent store and volatile. However, I'd always be open to something different if the maintainability/performance was the same or better. I would caution against PostgreSQL as a dependency as that would be more limiting than having a Redis dependency. While I do use PostgreSQL in some applications, we have to use other databases in other cases. |
Beta Was this translation helpful? Give feedback.
-
HTTP REST seems like an "out of external dependency" way to go. @palkan can you say a little more about how do you imagine it? |
Beta Was this translation helpful? Give feedback.
-
@kobaltz The idea is to avoid additional dependency if it's possible. Most Rails applications already use Redis, so they are likely to be OK with it (and that's why for now Redis is the only option, btw). But there are applications which don't use it. And that's the main reason why we're looking for alternatives. There can also be one more reason: performance and scalability. For i-dunno-how-much-large apps, it would be better to use RabbitMQ or even Kafka. We do not have to provide all possible options but an abstraction to build them (as separate gems). P.S. As you probably remember, Action Cable initially also depended on Redis, the community didn't like it. |
Beta Was this translation helpful? Give feedback.
-
@maurcarvalho Sure. Agree, that's the easiest option (from the development point of view). Assume that our WebSocket server implements HTTP endpoint to receive broadcast messages. Then we can write our def broadcast(channel, payload)
Net::HTTP.post_form(AnyCable.config.http_endpoint, { "channel" => channel, "payload" => payload })
end Of course, it's a very straightforward solution. It would be great to re-use connection ('keep-alive') of even have a connection pool, send requests asynchronously and deal with errors. Not so easy) |
Beta Was this translation helpful? Give feedback.
-
If you're already using GRPC, why not also use it to deliver messages to the server? It can be something like:
Now, this would make a server a bit harder to implement, which is something we need to consider. |
Beta Was this translation helpful? Give feedback.
-
That's the reason:
We have to run GRPC server as a part of our WebSocket server, which is not available yet for all languages (e.g. for Erlang). And another problem: consider clustered configuration – several WebSocket servers, several application servers. Then we need a GRPC balancer – yet another problem. |
Beta Was this translation helpful? Give feedback.
-
Okay, gotcha. I didn't even consider the load balancing part, which is a pretty big issue now that I think about it. An HTTP solution seems like it will likely be the best for now, in that case. |
Beta Was this translation helpful? Give feedback.
-
I think having nsq would be very interesting for the message passing. it enables the actioncable component to just put the message into a queue, and then each instance of the websocket server could register a channel on that queue with a name from a config file. This would allow multiple websocket servers to receive messages without concern for maintaining an active connection with the rails app. the rails app could also be modified to just be reading messages from a queue with a single channel. nsq has client libraries in many languages and is written in go. |
Beta Was this translation helpful? Give feedback.
-
What about MQTT ? |
Beta Was this translation helpful? Give feedback.
-
Although, MQTT-based broadcasting is possible, I think, it would too complicated for our use case. The main (IMO) feature of MQTT – quality of service – doesn't make sense in our case: if a WebSocket server is down and doesn't receive broadcast messages (through HTTP/Redis/queue), it's likely not to handle client connections too. Broadcast messages a ephemeral from the WS server point of view. At least for now. |
Beta Was this translation helpful? Give feedback.
-
love the idea of postgres pub/sub |
Beta Was this translation helpful? Give feedback.
-
Re:
Nice! 👍
Just trying to understand more, if understand correctly, the main advantage of AnyCable is: Wouldn't depending on a HTTP transport medium null the performance benefits that is gained by AnyCable specifically for small projects? I think it is also subjective of how small is a small project, but wondering to get more of your thoughts about it. |
Beta Was this translation helpful? Give feedback.
-
Yep, from the performance point of view there is no a huge benefit.
Yeah, that's a good question. |
Beta Was this translation helpful? Give feedback.
-
What’s the largest known anycable project? We are testing now if we can support 60k concurrent connections.
— Sent from my mobile
… On Jan 23, 2019, at 10:34 AM, Vladimir Dementyev ***@***.***> wrote:
Wouldn't depending on a HTTP transport medium null the performance benefits that is gained by AnyCable specifically for small projects?
Yep, from the performance point of view there is no a huge benefit.
But you can still have benefits from the resources usage point of view.
how small is a small project
Yeah, that's a good question.
We should think about the number of simultaneous connections (peak and average) and the message rate/payload size.
I think, the threshold to start thinking about AnyCable (instead of just Action Cable) is somewhere between 500 and 1000 connections on average or 5k-10k during peak hours.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Beta Was this translation helpful? Give feedback.
-
The largest project I'm aware of (and I'm not aware of the most of them, unfortunately) had ~10k concurrent connections (that's equipe.com, one year ago); they handled this with 4 1x dynos on Heroku (before switching to AnyCable they had 20 2x dynos for ActionCable).
Could you please share some information on your use case? |
Beta Was this translation helpful? Give feedback.
-
@palkan Thanks for the context! – I see you abstracted the broadcasting adapters already, I will give it a try with adding one of the broadcasting adapter options you listed above, I will tag you in a PR |
Beta Was this translation helpful? Give feedback.
-
@jtoy |
Beta Was this translation helpful? Give feedback.
-
hey we like the idea to add a rabbitmq adapter. Could you explain a bit more detailed which steps would be necessary to achive this? Is it right to also adapt the anycable-go app? |
Beta Was this translation helpful? Give feedback.
-
Hi @palkan, Anycable is an amazing project! I'm trying to build a prototype for my work. I read through anycable-go's source code. It seems anycable-go only subscribes to one redis pubsub channel, which is anycable. According to official Actioncable guide, Actioncable creates multiple redis pubsub channels. Could you please confirm this is a difference between Anycable and Actioncable? If it is the case, could you please share more details on that? I have been reading source code and searching answers online. But, there's very little information about how Anycable/Actioncable uses redis channels. Thank you so much! We are working for one of the largest tech company who is based on Ruby on Rails. Right now, we are building a concept proofing prototype using Anycable. Please help us, so we can persuade the leadership to invest resource on it. 🙏 |
Beta Was this translation helpful? Give feedback.
-
Are there any plans to support solid cable library? |
Beta Was this translation helpful? Give feedback.
-
Currently, AnyCable requires Redis as a dependency for the only one thing: sending messages from the application to the WebSocket server for broadcastings (
ActionCable.server.broadcast ...
).The idea is to provide more options for the users and thus not to require Redis for everyone.
TODO adapters:
Other possible options:
Beta Was this translation helpful? Give feedback.
All reactions