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

LIVE-6447 Create a connection for the processing of each SQS message #1217

Merged
merged 3 commits into from
Apr 17, 2024

Conversation

waisingyiu
Copy link
Contributor

@waisingyiu waisingyiu commented Apr 16, 2024

I paired with @aracho1 on this piece of work.

What does this change?

After merging PR #1216 , we saw IO exceptions when the android sender lambda sent notifications to a relatively larger group of device (more than several hundreds).

We used the same HttpClient instance for the processing of all SQS messages within an invocation of a lambda, and it appears that the HttpClient sent the requests over the same connection via HTTP/2. In larger notifications, it hit the limit on the maximum of concurrent stream over a connection.

This PR attempts to fix the problem by creating a HttpClient instance for the processing of each SQS message. Within each SQS message, there is a setting on concurrency level which specifies how many device token to send concurrently. This approach helps us to control the maximum number of concurrent stream we open when sending requests to Firebase API.

How to test

We tested locally and confirmed that we created as many HttpClient instances as the messages we are processing.

We also deployed to CODE, tested a notification and we were able to receive it on our Android emulator.

@waisingyiu waisingyiu marked this pull request as ready for review April 16, 2024 15:19
@waisingyiu waisingyiu requested a review from a team as a code owner April 16, 2024 15:19
@waisingyiu waisingyiu force-pushed the LIVE-6447-create-a-connection-for-each-message branch from 3a3d50a to b5eb60e Compare April 16, 2024 16:15
Copy link
Contributor

@lindseydew lindseydew left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Great work

@waisingyiu waisingyiu merged commit 53a4efc into main Apr 17, 2024
2 checks passed
@waisingyiu waisingyiu deleted the LIVE-6447-create-a-connection-for-each-message branch April 17, 2024 09:59
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.

2 participants