You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FR]Use multiplexing over HTTP2 in sendEachForMulticast method for batch push. #2488
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
When I upgrade fcm to Http V1, the speed will become very slow when using sendEachForMulticast in firebase-admin:9.2.0.
Isn't HTTP/2 used in the SDK?
Describe the solution you'd like
Convert bulk send in SDK to HTTP/2.
Describe alternatives you've considered
Keep the original sendMulticast method.
Additional context
According to the database conditions, users (hundreds of thousands) who meet the sending conditions are selected for message push.
If the current sendEachForMulticast is used, it will be a nightmare.
The following code took 15 seconds to execute.
List<String> registrationTokens = new ArrayList<>();
for (int i = 1; i <= 500; i++) {
registrationTokens.add(TOKEN + i);
}
MulticastMessage message = MulticastMessage.builder()
.setNotification(Notification.builder().setTitle("test title").setBody("test body").build())
.addAllTokens(registrationTokens).build();
BatchResponse response = FirebaseMessaging.getInstance().sendEachForMulticast(message);
System.out.println(response.getSuccessCount() + " messages were sent successfully");
Reacted by Johannes "Sepp" Stadler, Jean-Baptiste Gomez, MariuszTurek-W3media, jimnor0xF, Michael Wagner, fxwx23, TaejunPark, jintajinta, Ivan Beldad, James Holcomb and 4 more
@lahirumaramba, @jonathanedey Instead of just using HTTP/2 multiplexing I strongly advocate restoring the sendMulticast() method.
There is not much in computer science that can be said accross the board. But one of the few exceptions is, that IO operations, especially network requests, are slow compared to CPU bound operations. That's a fact, every software developer should know.
While it might be acceptable for small hobby projects to use sendEachForMulticast() to send messages in separate network requests, is is surely not for a company that is sending approx. 16 million messages per month.
It's a standard use case for us to send notifications to thousands of devices that are subscribed to some topics. While this was no problem with the legacy API, it will make thousands (!) of HTTP requests with the new API taking up seconds to minutes instead of milliseconds.
That doesn't only mean that user experience get's worse, due to delayed notifications, it also means, that our costs rise by a factor of 10, 15 or even more, as we are using serverless infrastructure that is billed by the millisecond.
Even if you don't care about performance and costs, this is a massive waste of resources. I honestly believe it is the task of every developer and software architect to be as efficient as possible with resources. Especially in the times, we live in.
=> It is therefore safe to say that this is a severe design error in the HTTP API v1.
And just in case you want to point out, that we should send to topics instead devices: that doesn't work either. Because it doesn't support the use case where we need to address users, that are interested in either one of multiple topics without sending duplicate notifications. (I don't even want to open a feature request suggesting this, as it is pretty much pointless, considering the other issues here.)
Also, the option mentioned in the docs, to use OR conditions, does also not work. It was obviously not built to scale. It works only for a very small number of topics, but with millions of topics, it takes many minutes for a single message to be delivered.
I really can't understand why you make these decisions and not listen to your users. It's very frustrating.
Reacted by Nicolas Prugne, 최혁수, Ares, James Holcomb, Jongwon Youn, 재훈, Björn Jensen-Urstad, hisui, niuxinxin, huairho and 9 more
Hey @MightySepp666 the support for batch send APIs including sendMulticast have been deprecated in the backend services, which is beyond scope for this SDK. Firebase Admin Node SDK (this repo) is essentially a wrapper for the REST API. We are actively looking into implementing http/2 to efficiently use the new FCM send API for batch requests. We will use this issue to track any progress.
I am not a serious node programmer, just want to simply replace the "sendMulticast" method to another one if deprecated. And don't want to shut out my server through using the super slow replacement.
I am sure 95% server maintainers have no idea that 1 month later their server will be crashed, after changing sendMulticast => sendEachForMulticast.
node firebase admin has been downloaded over 1 million per week. Do you guys think majority of those maintainers are smart enough to write their own batch codes?
Where are you spending my $1🧐☺️ paying for the firebase services?
I am just waiting for the crash going to be happening. As I don't really know how to resolve this situation actually.
Reacted by TaejunPark, James Holcomb, hisui and Jay Jain
@MightySepp666 Like you, I don't understand this step backwards. The sendAll method was introduced in the SDK because the use of individual send calls wasn't performing well enough. I understand that the maintainers of this repo can't do anything about it because they're not the ones in charge of developing the Firabse Messaging infrasctructure, but I think the problem should be brought to their attention.
Also, the topics system isn't usable because it involves sending exactly the same notification to users, but in most cases, the payload of each notification needs to be customized according to the person for whom the notification is intended, so it doesn't work.
I opened a ticket as suggested by @lahirumaramba to contact support. If you find a solution that improves performance I'm interested...
Reacted by Johannes "Sepp" Stadler and James Holcomb
@LebonNic I already opened a ticket as suggested some weeks ago. Hopefully you'll have better luck than me. To me it seems like Firebase is not interested in customer feedback (even if this most likely also increases their operating costs as well).
An interesting thing to mention is, that I've observed that the performance of the sendMulticast() is already extremely bad in our production environment - between 500ms to > 10 seconds (!) or more per call if you send to > 300 devices. This might be related to the bad response times of the Firebase backend since beginning of March (that is also causing problems with duplicate push notifications, as described in #1900 (comment)). But unfortunately, I don't have metrics of last year for comparison.
The sendEachForMulticast() adds additional latency on top. But interestingly, not linearly as I would have expected. That means, the deterioration factor is not as high as expected because the status quo is already quite bad.
Using this package may be an option if you cannot afford to wait for longer and need a workaround. Have not tested it myself so cannot vouch for how well it works. Ideally, the Firebase team should fix this as soon as possible.
@jimnor0xF thanks for the tip. But I looked at the code and it would be rather cumbersome for me to integrate. It's not a drop-in replacement and doesn't provide the other API methods of the Firebase SDK. Also I would require to patch it, like the regular Firebase SDK, due to the still open bug of duplicate push notifications caused by the retry functionality (see #1900 (comment)). It doesn't export types as well, so it's harder to integrate with TypeScript.
At the moment I am rather considering replacing Firebase completely by a different push notification provider backend.
@jimnor0xF thanks for the tip. But I looked at the code and it would be rather cumbersome for me to integrate. It's not a drop-in replacement and doesn't provide the other API methods of the Firebase SDK. Also I would require to patch it, like the regular Firebase SDK, due to the still open bug of duplicate push notifications caused by the retry functionality (see #1900 (comment)). It doesn't export types as well, so it's harder to integrate with TypeScript.
At the moment I am rather considering replacing Firebase completely by a different push notification provider backend.
I faced this issue too. Can you suggest another Firebase alternative service?
All users and businesses using the Firebase Admin SDK are experiencing the same issue.
I don't understand why they are pushing to end support for the legacy API (batch API) without showing any interest in user feedback. firebase/firebase-admin-java#941
Reacted by Johannes "Sepp" Stadler, James Holcomb, hisui, Antoine Kleinpeter and LeeKwangsub
Thank you for your patience! With the release of v12.3.0, sendEach() and sendEachForMulitcast() now use a HTTP/2 connection by default when sending messages. We'd like for you to give it a try and give us your feedback on these changes.
While we work through this transition, if you are facing any issues with the new HTTP/2 transport, we have provided access to the legacy HTTP/1.1 versions of these methods. This can be enabled by using the enableLegacyTransport() method. This method is already marked as deprecated and will be removed once the HTTP/2 transport is considered fully stable.
Reacted by Naoto Ikeno, Manuel, HeaukJun Yoo, Antoine Kleinpeter, TaejunPark, mygreen and Rebsos
There is no support for HTTP/2 multiplexing yet, so notifications are sent over a single HTTP/2 connection, which is limited to 100 concurrent streams (requests).
This means that only 100 notifications can be sent at any given time over this single connection, which makes firebase-admin unsuitable for use cases that require high throughput (>100 notifications per second).
Hey @victorHugoCarvalho,
The current implementation does use HTTP/2 multiplexing. Each call to sendEach() or sendEachForMulitcast() creates a new connection with 100 concurrent streams. Meaning 2 sendEach() calls would result in 2 HTTP/2 connections with 200 concurrent streams and 200 messages in flight at a time.
If the issue here is having a 1 to 1 ratio of streams to messages this can be done by batching your sendEach() calls with 100 messages each rather than the allowed maximum of 500.
If this isn't the behaviour you are experiencing please open a new issue and we can take a look there.
The problem we are facing is precisely the delay in sending these notifications. Overall we are making 450 calls to sendEachForMulticast() where each batch has 500 tokens.
I'm wondering if the revised sendEachForMulitcast() resolves the duplicate message issue. The performance hit I can take, but the duplicate message issue is a serious deal breaker. This is happening with fcm-v1-http2 and I'm getting a ton of complaints from my users.
We hit exactly this in production (a push relay for enterprise messaging; load-tested to ~650k messages at ~2,000 rps), and I'd like to share measurements plus a working mitigation, since the per-call session model turned out to be the root cause of a persistent tail-latency problem — not just a throughput concern.
The problem is the handshake, not the multiplexing
As @jonathanedey noted, each sendEach() call creates its own HTTP/2 connection (100 streams). We confirmed this is still the case on current master: sendEach constructs a new Http2SessionHandler per call and closes it in .finally(). The behavior is identical in 12.7.0 / 13.10 / 14.1 (we diffed the relevant code paths).
The consequence: every call pays a fresh TCP+TLS+H2 handshake. Connection establishment is uniquely fragile — if the SYN or first TLS packet is lost, recovery happens only via kernel exponential backoff (1→2→4→8→16s). An established connection recovers via fast retransmit; a new one rolls those dice on every single call.
Production numbers (worker using sendEach batching, before any mitigation):
~0.2% of sendEach calls took 10–30s (706 slow calls in one 6h window; ~100+ per 12h on a typical day)
The ceiling was exactly 30s = default 15s request timeout × 2 attempts
Slow calls clustered in episodes and did not correlate with traffic bursts — consistent with path-quality episodes hitting the handshake, not load
A synthetic reproduction (50% SYN drop) makes it obvious: per-call sessions → p50 1.2s, 55% of calls over 1s; a reused session under the same loss → p50 90ms.
What we did: reuse the session across calls
We patched (at runtime, no fork) Http2SessionHandler to serve a small pool of long-lived sessions (2–4, round-robin) instead of one per call. Results, A/B against unmodified per-call sendEach:
30-min soak, ~36k real FCM messages each side: p50 271→184ms, p95 463→282ms, p99.9 1555→1105ms, max 2770→2017ms; CPU roughly halved
1h soak with injected SYN-loss episodes (~49k messages each side): responses over 30s: 509 → 0; time-to-final-result over 60s: 287 → 0
Production canary (same worker, before → after): 10s+ calls went from ~100+/12h to 0, sustained over multiple days of unchanged traffic
Sustained k6 run, 466k requests ramping to 2,000 rps: session count stayed flat at 8, 1 failure total (0.0002%)
Lifecycle lessons (in case the team considers building this in)
Reuse is not just "cache the session" — the things that actually bit us:
Drain, don't close. Closing a session with active streams loses in-flight response bodies (observed on Node 16). We count active streams and only close at 0, with a delayed destroy as a safety net. GOAWAY should also drain (the server permits in-flight completion), not destroy.
Pre-warm replacements. Evict a bad session immediately, but only put its replacement into rotation after connect completes — so traffic never queues behind a handshake.
Health-check with H2 PING (we use a 30s interval / 3s RTT threshold) to catch "gray" sessions and silent NAT drops, with a cap of one eviction per round so a genuinely bad path doesn't cause handshake storms (which would degenerate back to per-call behavior).
Passive outlier ejection (Envoy-style): N consecutive stream failures on one session → immediate drain-replace, don't wait for the next ping round.
Duplicate safety on retry: only streams still in pending state (no stream ID assigned = provably never sent) are safe to fail fast for early retry; anything already written must keep the SDK's normal timeout semantics.
Happy to share more details, and if maintainers are open to it I'd be glad to work on a PR that adds opt-in session reuse (e.g. a messaging option, keeping today's per-call behavior as the default).
Two findings, both deterministic across runs (verified against firebase-admin 14.2.0):
Within a call, requests are indeed fully multiplexed on one session (up to perCall concurrent streams on a single connection) — consistent with what @jonathanedey described earlier in this thread.
Across calls, every sendEach() / sendEachForMulticast() call opens a new HTTP/2 session (N calls → N sessions, counted at the http2.connect boundary), so there is no session reuse across calls — under bursty many-call workloads the TLS + HTTP/2 handshake lands on the hot path of every call.
Would the maintainers be open to an external contribution here — an opt-in, default-off session-reuse mode? Subject to any necessary approvals on my side, I'd start with a short design proposal (session lifecycle, GOAWAY/reconnect handling, concurrency limits, shutdown) and proceed only if the direction fits the project.
Hi @milcho0604 ,
Thanks for putting this together. This is really valuable feedback. Two things we have been looking at internally are:
Removing the 500-message send limit across our SDKs, since that was only a constraint for the legacy batch endpoint. (Helps but isn't the root issue)
Implementing more robust connection and session management here in Node.
These metrics are extremely helpful in guiding the prioritization of the latter. An opt-in reuse option might be a good option here but we haven't had the chance to thoroughly investigate. If you are wiling, I think a short design proposal would be a reasonable next step. We would then take that proposal through our internal process and once the team aligns on a path forward, we'd also be open to code contributions if you'd like to submit a PR!
Opt-in, default-off — the default path is unchanged (per-call handler, not even constructed otherwise).
Generation-based lifecycle — one session + its own error list + listeners per generation (accepting → draining → closed); leases pin a generation, so late events from a replaced session never leak into its successor.
No readiness gate, no retry changes — the session is handed out immediately as today (Node buffers request() while connecting), so sendEach() keeps its exact contract: always resolves with a BatchResponse, connection problems appear as per-message failures.
GOAWAY — same semantics as today's mid-call GOAWAY; the generation drains and the next call reconnects lazily. No automatic re-send in v1.
Backpressure — an outstanding-request budget with fallback to a per-call session under heavy concurrency (a 500-message batch always reuses; only unbounded pileup degrades to current behavior).
Shutdown — an internal Messaging.delete() following the existing DatabaseService.delete() precedent, so deleteApp(app) leaves no session handles; no public API surface added.
The bigger calls — API shape, budget policy, idle defaults — are left as open questions for the team. The proposal is intended as a starting point for the team's discussion, and I'm happy to revise, split, or narrow the scope based on your feedback. Thanks again for being open to this!
Activity
google-oss-bot commentedon Mar 7, 2024
I found a few problems with this issue:
MightySepp666 commentedon Apr 16, 2024
@lahirumaramba, @jonathanedey Instead of just using HTTP/2 multiplexing I strongly advocate restoring the
sendMulticast()method.There is not much in computer science that can be said accross the board. But one of the few exceptions is, that IO operations, especially network requests, are slow compared to CPU bound operations. That's a fact, every software developer should know.
While it might be acceptable for small hobby projects to use
sendEachForMulticast()to send messages in separate network requests, is is surely not for a company that is sending approx. 16 million messages per month.It's a standard use case for us to send notifications to thousands of devices that are subscribed to some topics. While this was no problem with the legacy API, it will make thousands (!) of HTTP requests with the new API taking up seconds to minutes instead of milliseconds.
That doesn't only mean that user experience get's worse, due to delayed notifications, it also means, that our costs rise by a factor of 10, 15 or even more, as we are using serverless infrastructure that is billed by the millisecond.
Even if you don't care about performance and costs, this is a massive waste of resources. I honestly believe it is the task of every developer and software architect to be as efficient as possible with resources. Especially in the times, we live in.
=> It is therefore safe to say that this is a severe design error in the HTTP API v1.
And just in case you want to point out, that we should send to topics instead devices: that doesn't work either. Because it doesn't support the use case where we need to address users, that are interested in either one of multiple topics without sending duplicate notifications. (I don't even want to open a feature request suggesting this, as it is pretty much pointless, considering the other issues here.)
Also, the option mentioned in the docs, to use
ORconditions, does also not work. It was obviously not built to scale. It works only for a very small number of topics, but with millions of topics, it takes many minutes for a single message to be delivered.I really can't understand why you make these decisions and not listen to your users. It's very frustrating.
lahirumaramba commentedon Apr 16, 2024
Hey @MightySepp666 the support for batch send APIs including
sendMulticasthave been deprecated in the backend services, which is beyond scope for this SDK. Firebase Admin Node SDK (this repo) is essentially a wrapper for the REST API. We are actively looking into implementing http/2 to efficiently use the new FCM send API for batch requests. We will use this issue to track any progress.In the meantime, I'd recommend filing a Firebase support ticket from https://firebase.google.com/support/troubleshooter/contact to share your feedback on the above to reach the correct internal teams.
jimnor0xF commentedon May 7, 2024
Hope this gets prioritized soon. Critical issue IMO.
TaejunPark commentedon May 8, 2024
I am not a serious node programmer, just want to simply replace the "sendMulticast" method to another one if deprecated. And don't want to shut out my server through using the super slow replacement.
I am sure 95% server maintainers have no idea that 1 month later their server will be crashed, after changing sendMulticast => sendEachForMulticast.☺️ paying for the firebase services?
node firebase admin has been downloaded over 1 million per week. Do you guys think majority of those maintainers are smart enough to write their own batch codes?
Where are you spending my $1🧐
I am just waiting for the crash going to be happening. As I don't really know how to resolve this situation actually.
LebonNic commentedon May 14, 2024
@MightySepp666 Like you, I don't understand this step backwards. The
sendAllmethod was introduced in the SDK because the use of individualsendcalls wasn't performing well enough. I understand that the maintainers of this repo can't do anything about it because they're not the ones in charge of developing the Firabse Messaging infrasctructure, but I think the problem should be brought to their attention.Also, the topics system isn't usable because it involves sending exactly the same notification to users, but in most cases, the payload of each notification needs to be customized according to the person for whom the notification is intended, so it doesn't work.
I opened a ticket as suggested by @lahirumaramba to contact support. If you find a solution that improves performance I'm interested...
MightySepp666 commentedon May 14, 2024
@LebonNic I already opened a ticket as suggested some weeks ago. Hopefully you'll have better luck than me. To me it seems like Firebase is not interested in customer feedback (even if this most likely also increases their operating costs as well).
An interesting thing to mention is, that I've observed that the performance of the
sendMulticast()is already extremely bad in our production environment - between 500ms to > 10 seconds (!) or more per call if you send to > 300 devices. This might be related to the bad response times of the Firebase backend since beginning of March (that is also causing problems with duplicate push notifications, as described in #1900 (comment)). But unfortunately, I don't have metrics of last year for comparison.The
sendEachForMulticast()adds additional latency on top. But interestingly, not linearly as I would have expected. That means, the deterioration factor is not as high as expected because the status quo is already quite bad.jimnor0xF commentedon May 15, 2024
@LebonNic @MightySepp666
Using this package may be an option if you cannot afford to wait for longer and need a workaround. Have not tested it myself so cannot vouch for how well it works. Ideally, the Firebase team should fix this as soon as possible.
MightySepp666 commentedon May 16, 2024
@jimnor0xF thanks for the tip. But I looked at the code and it would be rather cumbersome for me to integrate. It's not a drop-in replacement and doesn't provide the other API methods of the Firebase SDK. Also I would require to patch it, like the regular Firebase SDK, due to the still open bug of duplicate push notifications caused by the retry functionality (see #1900 (comment)). It doesn't export types as well, so it's harder to integrate with TypeScript.
At the moment I am rather considering replacing Firebase completely by a different push notification provider backend.
nvti commentedon May 21, 2024
I faced this issue too. Can you suggest another Firebase alternative service?
honorhs commentedon May 21, 2024
All users and businesses using the Firebase Admin SDK are experiencing the same issue.
I don't understand why they are pushing to end support for the legacy API (batch API) without showing any interest in user feedback.
firebase/firebase-admin-java#941
victorHugoCarvalho commentedon Jun 10, 2024
Any progress regarding this topic?
jonathanedey commentedon Jul 25, 2024
Thank you for your patience! With the release of v12.3.0,
sendEach()andsendEachForMulitcast()now use a HTTP/2 connection by default when sending messages. We'd like for you to give it a try and give us your feedback on these changes.While we work through this transition, if you are facing any issues with the new HTTP/2 transport, we have provided access to the legacy HTTP/1.1 versions of these methods. This can be enabled by using the
enableLegacyTransport()method. This method is already marked as deprecated and will be removed once the HTTP/2 transport is considered fully stable.victorHugoCarvalho commentedon Sep 19, 2024
There is no support for HTTP/2 multiplexing yet, so notifications are sent over a single HTTP/2 connection, which is limited to 100 concurrent streams (requests).
This means that only 100 notifications can be sent at any given time over this single connection, which makes firebase-admin unsuitable for use cases that require high throughput (>100 notifications per second).
Any estimate for when this will be available?
jonathanedey commentedon Sep 19, 2024
Hey @victorHugoCarvalho,
The current implementation does use HTTP/2 multiplexing. Each call to
sendEach()orsendEachForMulitcast()creates a new connection with 100 concurrent streams. Meaning 2sendEach()calls would result in 2 HTTP/2 connections with 200 concurrent streams and 200 messages in flight at a time.If the issue here is having a 1 to 1 ratio of streams to messages this can be done by batching your
sendEach()calls with 100 messages each rather than the allowed maximum of 500.If this isn't the behaviour you are experiencing please open a new issue and we can take a look there.
victorHugoCarvalho commentedon Sep 19, 2024
Hey @jonathanedey,
The problem we are facing is precisely the delay in sending these notifications. Overall we are making 450 calls to sendEachForMulticast() where each batch has 500 tokens.
Fix usage of deprecated FCM call causing failures.
bigriot commentedon Feb 4, 2025
Hi everyone,
I'm wondering if the revised sendEachForMulitcast() resolves the duplicate message issue. The performance hit I can take, but the duplicate message issue is a serious deal breaker. This is happening with fcm-v1-http2 and I'm getting a ton of complaints from my users.
milcho0604 commentedon Jul 21, 2026
We hit exactly this in production (a push relay for enterprise messaging; load-tested to ~650k messages at ~2,000 rps), and I'd like to share measurements plus a working mitigation, since the per-call session model turned out to be the root cause of a persistent tail-latency problem — not just a throughput concern.
The problem is the handshake, not the multiplexing
As @jonathanedey noted, each
sendEach()call creates its own HTTP/2 connection (100 streams). We confirmed this is still the case on currentmaster:sendEachconstructs a newHttp2SessionHandlerper call and closes it in.finally(). The behavior is identical in 12.7.0 / 13.10 / 14.1 (we diffed the relevant code paths).The consequence: every call pays a fresh TCP+TLS+H2 handshake. Connection establishment is uniquely fragile — if the SYN or first TLS packet is lost, recovery happens only via kernel exponential backoff (1→2→4→8→16s). An established connection recovers via fast retransmit; a new one rolls those dice on every single call.
Production numbers (worker using
sendEachbatching, before any mitigation):sendEachcalls took 10–30s (706 slow calls in one 6h window; ~100+ per 12h on a typical day)A synthetic reproduction (50% SYN drop) makes it obvious: per-call sessions → p50 1.2s, 55% of calls over 1s; a reused session under the same loss → p50 90ms.
What we did: reuse the session across calls
We patched (at runtime, no fork)
Http2SessionHandlerto serve a small pool of long-lived sessions (2–4, round-robin) instead of one per call. Results, A/B against unmodified per-callsendEach:Lifecycle lessons (in case the team considers building this in)
Reuse is not just "cache the session" — the things that actually bit us:
connectcompletes — so traffic never queues behind a handshake.pendingstate (no stream ID assigned = provably never sent) are safe to fail fast for early retry; anything already written must keep the SDK's normal timeout semantics.Happy to share more details, and if maintainers are open to it I'd be glad to work on a PR that adds opt-in session reuse (e.g. a messaging option, keeping today's per-call behavior as the default).
milcho0604 commentedon Jul 23, 2026
Thanks for the responses here. To make this concrete, I put together a small, fully reproducible benchmark — Node built-ins plus a check against the real
firebase-adminSDK, fully offline (no credentials needed): https://github.com/milcho0604/http2-session-reuse-benchTwo findings, both deterministic across runs (verified against firebase-admin 14.2.0):
perCallconcurrent streams on a single connection) — consistent with what @jonathanedey described earlier in this thread.sendEach()/sendEachForMulticast()call opens a new HTTP/2 session (N calls → N sessions, counted at thehttp2.connectboundary), so there is no session reuse across calls — under bursty many-call workloads the TLS + HTTP/2 handshake lands on the hot path of every call.Would the maintainers be open to an external contribution here — an opt-in, default-off session-reuse mode? Subject to any necessary approvals on my side, I'd start with a short design proposal (session lifecycle, GOAWAY/reconnect handling, concurrency limits, shutdown) and proceed only if the direction fits the project.
jonathanedey commentedon Jul 23, 2026
Hi @milcho0604 ,
Thanks for putting this together. This is really valuable feedback. Two things we have been looking at internally are:
These metrics are extremely helpful in guiding the prioritization of the latter. An opt-in reuse option might be a good option here but we haven't had the chance to thoroughly investigate. If you are wiling, I think a short design proposal would be a reasonable next step. We would then take that proposal through our internal process and once the team aligns on a path forward, we'd also be open to code contributions if you'd like to submit a PR!
docs: design proposal — opt-in HTTP/2 session reuse across sendEach()…
milcho0604 commentedon Jul 24, 2026
Hi @jonathanedey, thank you for the guidance — as suggested, I've put together a design proposal for the opt-in session-reuse mode:
📄 Design Proposal: Opt-in HTTP/2 session reuse across
sendEach()callsKey points, briefly:
accepting → draining → closed); leases pin a generation, so late events from a replaced session never leak into its successor.request()while connecting), sosendEach()keeps its exact contract: always resolves with aBatchResponse, connection problems appear as per-message failures.Messaging.delete()following the existingDatabaseService.delete()precedent, sodeleteApp(app)leaves no session handles; no public API surface added.The bigger calls — API shape, budget policy, idle defaults — are left as open questions for the team. The proposal is intended as a starting point for the team's discussion, and I'm happy to revise, split, or narrow the scope based on your feedback. Thanks again for being open to this!
jonathanedey commentedon Jul 24, 2026
Thanks @milcho0604 , I'll share this with the team. I can't provide an estimate on timeline but if there are any updates we'll provide them here.