Skip to content

JS IAsyncEnumerable ConsumeAsync - high network traffic #813

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

Open
ealeykin opened this issue Apr 8, 2025 · 1 comment
Open

JS IAsyncEnumerable ConsumeAsync - high network traffic #813

ealeykin opened this issue Apr 8, 2025 · 1 comment

Comments

@ealeykin
Copy link

ealeykin commented Apr 8, 2025

Observed behavior

Not quite sure what is causing this, but this is what I observed after switching from IAsyncEnumerable to NextAsync for JS consumer:

Image

IAsyncEnumerable ConsumeAsync was configured with MaxMsg = 1. Also MaxAckPending = 1.

Also many messages were NAKed without even being handled by application consumer handler (basically many messages were put to DLQ for no reason). Maybe related to Heart beat issue #793 .

Expected behavior

Network traffic is the same for both ConsumeAsync with MaxMsg=1 and NextAsync

Server and client version

server - 2.10
client - 2.5.12

Host environment

AWS/ECS

Steps to reproduce

NatsJSContext: ConsumeAsync vs NextAsync

@mtmk
Copy link
Member

mtmk commented Apr 11, 2025

sorry for the late response. Just comparing the network for consume(maxMsgs=1) vs. next() and to me it looks like next is actually creating more traffic because it has the subscribe the unsubscribe to an inbox for every message, as expected. Could you provide more details about the calls with code samples? i will try to reproduce.

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

No branches or pull requests

2 participants