Skip to content
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

Tracking: PubSub performance and UX improvements #7156

Closed
creachadair opened this issue Oct 26, 2021 · 1 comment
Closed

Tracking: PubSub performance and UX improvements #7156

creachadair opened this issue Oct 26, 2021 · 1 comment
Labels
C:events Component: Events stale for use by stalebot T:code-hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Milestone

Comments

@creachadair
Copy link

creachadair commented Oct 26, 2021

☂️ This issue tracks a handful of improvements to the Tendermint pubsub library targeting the v0.36 release.

See also RFC 006 Event Subscription and ADR 075 RPC Event Subscription.

In Scope

The overall goal of this work is to address the following performance, API, and usability concerns:

  • The API supports "unbuffered" (blocking) subscriptions, which stall the entire publisher with no timeout until serviced. This is a special case to support event indexing, but it means that indexing can stall subscriber service, and vice versa, and that feedback can stall or slow consensus.

  • Ordinary ("buffered") subscriptions are use a fixed-length Go channel as a queue, and if a client does not service its subscriptions fast enough (i.e., the buffer fills), the publisher will terminate the subscription. However, events do not arrive at an even pace, and a large bolus of events may overwhelm the channel in a very short period of time, even if a client is servicing its events optimally (see for example Tendermint emits events over WebSocket faster than any clients can pull them if tx includes many events #6729). (Enqueues take nanoseconds or microseconds; network delivery takes milliseconds, even for fast local connections)

  • The publish/subscribe plumbing is very complicated, and tightly coupled with indexing. This is mainly a maintenance issue, but also adds overhead that interacts negatively with the stall-pushback on the rest of consensus.

Out of Scope

Related Changes

@creachadair creachadair added the T:code-hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity. label Oct 26, 2021
@creachadair creachadair self-assigned this Oct 26, 2021
@creachadair creachadair added the C:events Component: Events label Oct 26, 2021
creachadair pushed a commit that referenced this issue Nov 1, 2021
Updates #7156, and a follow-up to #7070.

Event subscriptions in Tendermint currently use a fixed-length Go
channel as a queue. When the channel fills up, the publisher
immediately terminates the subscription. This prevents slow
subscribers from creating memory pressure on the node by not
servicing their queue fast enough.

Replace the buffered channel used to deliver events to buffered
subscribers with an explicit queue. The queue provides a soft
quota and burst credit mechanism: Clients that usually keep up
can survive occasional bursts, without allowing truly slow
clients to hog resources indefinitely.
creachadair pushed a commit that referenced this issue Nov 5, 2021
This is part of the work described by #7156.

Remove "unbuffered subscriptions" from the pubsub service.
Replace them with a dedicated blocking "observer" mechanism.
Use the observer mechanism for indexing.

Add a SubscribeWithArgs method and deprecate the old Subscribe
method. Remove SubscribeUnbuffered entirely (breaking).

Rework the Subscription interface to eliminate exposed channels.
Subscriptions now use a context to manage lifecycle notifications.

Internalize the eventbus package.
@cmwaters cmwaters added this to the v0.36 milestone Nov 18, 2021
tychoish pushed a commit to tychoish/tendermint that referenced this issue Nov 19, 2021
…t#7231)

This is part of the work described by tendermint#7156.

Remove "unbuffered subscriptions" from the pubsub service.
Replace them with a dedicated blocking "observer" mechanism.
Use the observer mechanism for indexing.

Add a SubscribeWithArgs method and deprecate the old Subscribe
method. Remove SubscribeUnbuffered entirely (breaking).

Rework the Subscription interface to eliminate exposed channels.
Subscriptions now use a context to manage lifecycle notifications.

Internalize the eventbus package.
@creachadair
Copy link
Author

@cmwaters cmwaters pinned this issue Jan 4, 2022
@creachadair creachadair removed their assignment Jul 21, 2022
@cmwaters cmwaters unpinned this issue Jul 26, 2022
@github-actions github-actions bot added the stale for use by stalebot label Jun 5, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:events Component: Events stale for use by stalebot T:code-hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Projects
None yet
Development

No branches or pull requests

2 participants