8000 Proxy Streams: individual GRPC streams to the backend for connection or subscription by FZambia · Pull Request #680 · centrifugal/centrifugo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Proxy Streams: individual GRPC streams to the backend for connection or subscription #680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from

Conversation

FZambia
Copy link
Member
@FZambia FZambia commented Jul 22, 2023

Proposed changes

Proposing an experimental feature called Proxy Streams.

Proxy streams allow pushing data towards client channel subscription (and optionally connection itself) directly and individually from your application backend over the unidirectional or bidirectional GRPC stream.

The stream is established between Centrifugo and your application backend as soon as user subscribes to a channel (or connects to Centrifugo). The scheme may be useful if you want to generate individual streams and these streams should only work for a time while client is connected or subscribed to a channel.

In this case Centrifugo plays a role of WebSocket-to-GRPC streaming proxy – keeping numerous real-time connections from application's clients and establishing GRPC streams to the backend, multiplexing them using a pool of HTTP/2 (transport used by GRPC) connections.

This may be configured similar to our connect or subscribe proxies. For connection level stream proxy we open unidirectional or bidirectional GRPC stream for the time of connection liveness (backend can close stream at any point). For subscription level stream proxy we open unidirectional or bidirectional GRPC stream for the time of subscription liveness (backend can close stream at any point).

The downside of the idea is the number of additional goroutines we need for each such stream. Every stream will cost 3 extra goroutines. So for a WS connection with 5 streams the number of goroutines is 2 + 5*3 = 17. This will result into more CPU and more memory. This fact prevents me from proceeding right away. On the other hand the approach should scale horizontally (scaling GRPC on the backend is not a straightforward but definitely possible). Not every use case involves millions concurrent GRPC streams.

on_demand_stream_connections

@FZambia FZambia changed the title New feature: Proxy Streams Proxy Streams: individual GRPC streams to the backend for connection or subscription Jul 23, 2023
@FZambia
Copy link
Member Author
FZambia commented Oct 6, 2023

Replaced by #722

@FZambia FZambia closed this Oct 6, 2023
@FZambia FZambia deleted the proxy_streams branch December 26, 2023 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0