Skip to content

Conversation

@ndr-ds
Copy link
Contributor

@ndr-ds ndr-ds commented Dec 1, 2025

Motivation

Sending notifications one at a time creates high RPC overhead. Batching notifications reduces overhead and improves
throughput.

Proposal

  • Add NotifyBatch RPC method for sending multiple notifications at once
  • Implement BatchForwarder for collecting and sending batched notifications
  • Configure batch sizes and timeouts

Test Plan

  • Deploy and verify notifications are batched
  • Monitor notification latency and throughput
  • Check for any dropped notifications

Release Plan

  • Nothing to do / These changes follow the usual release cycle.

@ndr-ds ndr-ds force-pushed the 11-28-make_notification_and_cross_chain_queue_sizes_grow_with_network_size branch from 0119199 to 4a1d5ca Compare December 2, 2025 12:55
@ndr-ds ndr-ds force-pushed the 12-01-send_notifications_in_batches branch from b1e7db4 to 106ed89 Compare December 2, 2025 12:55
@ndr-ds ndr-ds force-pushed the 11-28-make_notification_and_cross_chain_queue_sizes_grow_with_network_size branch from 4a1d5ca to c627bad Compare December 2, 2025 13:26
@ndr-ds ndr-ds force-pushed the 12-01-send_notifications_in_batches branch from 106ed89 to 5c1a62d Compare December 2, 2025 13:26
@ndr-ds ndr-ds force-pushed the 11-28-make_notification_and_cross_chain_queue_sizes_grow_with_network_size branch from c627bad to 6c566c1 Compare December 3, 2025 21:30
@ndr-ds ndr-ds force-pushed the 12-01-send_notifications_in_batches branch 2 times, most recently from 3a99dd2 to 8473288 Compare December 4, 2025 12:31
@ndr-ds ndr-ds force-pushed the 11-28-make_notification_and_cross_chain_queue_sizes_grow_with_network_size branch from 6c566c1 to 469db12 Compare December 4, 2025 12:31
@ndr-ds ndr-ds changed the base branch from 11-28-make_notification_and_cross_chain_queue_sizes_grow_with_network_size to graphite-base/5054 December 11, 2025 15:35
@ndr-ds ndr-ds force-pushed the graphite-base/5054 branch from 469db12 to 58b94ab Compare December 11, 2025 15:35
@ndr-ds ndr-ds force-pushed the 12-01-send_notifications_in_batches branch from 8473288 to 742eb97 Compare December 11, 2025 15:35
@ndr-ds ndr-ds changed the base branch from graphite-base/5054 to 11-28-several_metrics_changes December 11, 2025 15:36
@ndr-ds ndr-ds force-pushed the 11-28-several_metrics_changes branch from 58b94ab to 8b41b5a Compare December 15, 2025 22:00
@ndr-ds ndr-ds force-pushed the 12-01-send_notifications_in_batches branch from 742eb97 to 6e01efd Compare December 15, 2025 22:00
@ndr-ds ndr-ds force-pushed the 11-28-several_metrics_changes branch from 8b41b5a to bb38573 Compare January 7, 2026 18:42
@ndr-ds ndr-ds force-pushed the 12-01-send_notifications_in_batches branch 2 times, most recently from 3dbb400 to 514f4b7 Compare January 7, 2026 22:26
@ndr-ds ndr-ds force-pushed the 11-28-several_metrics_changes branch from bb38573 to 26e0c2b Compare January 7, 2026 22:26
Copy link
Contributor Author

ndr-ds commented Jan 7, 2026

I can also try to keep notify around to hopefully make this backwards compatible

@ndr-ds ndr-ds marked this pull request as ready for review January 7, 2026 22:39
@ndr-ds ndr-ds force-pushed the 11-28-several_metrics_changes branch from 26e0c2b to c0eced0 Compare January 7, 2026 22:43
@ndr-ds ndr-ds force-pushed the 12-01-send_notifications_in_batches branch 2 times, most recently from b618da9 to dc6d19a Compare January 7, 2026 23:59
@ndr-ds ndr-ds force-pushed the 11-28-several_metrics_changes branch from c0eced0 to 73b4c94 Compare January 8, 2026 01:13
@ndr-ds ndr-ds force-pushed the 12-01-send_notifications_in_batches branch from dc6d19a to 3876afe Compare January 8, 2026 01:13
@deuszx
Copy link
Contributor

deuszx commented Jan 8, 2026

For the future (but also this PR):

When you're making PRs that claim to improve performance I'd like to see some comparison/data for before vs after. It can be screenshots from Grafana, copy-paste from the terminal etc.

Copy link
Contributor

@afck afck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this batches notifications when sending them server→proxy or server→exporter, but not proxy→client, right? (Would be helpful to clarify that in the description.)

I'd also like to see more data about how this improves performance. Approving assuming the improvement is significant.

exporter_clients: Vec<NotifierServiceClient<Channel>>,
pending_notifications: Vec<Notification>,
futures: FuturesUnordered<BoxFuture<'static, ()>>,
tasks_in_flight: usize,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this redundant? Isn't it always equal to self.futures.len()?

}
Err(status) => {
// We assume errors when parsing are not critical and just log them.
tracing::warn!(error=?status, "received bad notification");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Not in this PR, but: Why not call the variable error? Or log it as ?status?)

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.

4 participants