Cannot listen to more than 20 subscriptions?
Thanks for stopping by to ask us a question! Please make sure to include:
- What you're trying to do
Ive spent the last 2 days trial and error-ing a lot of parameters, but as soon as I listen to more than 20 subscriptions. I am no longer able to 'ack' any messages.
I am using Exactly Once Delivery and ackWithResponse() just hangs as soon as I start more than 20 listeners, I have rotated which subs these are and it seems purely the number of subs, not what they are.
Is there a config item Ive missed in GCP / Pubsub somewhere?
Thanks!
-
What code you've already tried
-
Any error messages you're getting No error messages or warnings about max event listeners or anything
Eventually if I wait 10 mins I will get the below error, this is 10 minutes after calling ackWithResponse() and hanging
"type": "AckError",
"message": "INVALID : Retried for too long",
"stack":
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
I just found this, and changing the maxStreams to 3 have fixed it for me. However I will leave this open as the error that was reported back then is no longer being surfaced - making it hard to figure out!
https://github.com/googleapis/nodejs-pubsub/issues/550
@daffron Thanks for both the issue and the follow-up! I'm glad you found a workaround, but I'll want to look at this still.
This could relate to a hard limit on PubSub clients where a client can only handle 100 streams. We have a service that subscribes to multiple subscriptions. And initially, we had that issue we opened a ticket with GCP support. So by default, all subscriptions share the same client and each subscription has 5 streams. So the workaround mentioned above might work for you but eventually, you will hit the hard limit again if you have more subscriptions. In our case, we compute the client that the service needs based on the number of subscriptions. we have 10 subscriptions per client which are 50 streams per client. However, we do not have Exactly Once Delivery feature enable, so I am not sure if this is applied to your use case.
You can refer to this document. https://cloud.google.com/nodejs/docs/reference/pubsub/latest/pubsub/subscription#:~:text=By%20default%20each,each%20Subscription%20object.
My understanding is that making many subscribers (not just streams, but different subscriptions) in one client is considered a bit of an anti-pattern, but it seems like it should still be able to either do it reliably, or at least notify you gracefully that it's not going to work.
Oh I see, so one PubSub client per 1 Subscriber is recommended?
On Thu, Apr 13, 2023 at 12:43 AM Megan Potter @.***> wrote:
My understanding is that making many subscribers (not just streams, but different subscriptions) in one client is considered a bit of an anti-pattern, but it seems like it should still be able to either do it reliably, or at least notify you gracefully that it's not going to work.
— Reply to this email directly, view it on GitHub https://github.com/googleapis/nodejs-pubsub/issues/1705#issuecomment-1505594625, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3BEIG4THHC2VEZ3XVOZM3XA3LRRANCNFSM6AAAAAAWSQTOCY . You are receiving this because you were mentioned.Message ID: @.***>
--
Jack Daffron
Daffron LtdWeb Development (+61) 0473 946 906
@daffron We talked about this today at our status meeting, and the conclusion is that 20 subscribers in one client is not something we don't support, just that you may start running up against grpc limitations (it has a stream limit, and that would be shared within one client (PubSub object)). If you're still having troubles with this, you might try breaking it up into several clients with fewer streams.
@feywind Just saw this! - Thanks for getting back to me, that makes sense!
I would prefer that the library internally takes care of it, i.e. by creating one grpc client per subscription rather than the consumers having to do this.
I'm having problems pulling messages from subscriptions even if there are less than 20 subscriptions in an instance.
Initially, I limited each instance to 20 subscribers. Some subscriptions were successful, while others were unable to pull messages at all.
I then set it to 10 subscribers. I experienced a similar issue again.
I'm currently testing one instance per subscription.
I have approximately 40 subscriptions.