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

Allow highWaterMark for Channel to be configured #264

Open
arei opened this issue Aug 3, 2016 · 3 comments
Open

Allow highWaterMark for Channel to be configured #264

arei opened this issue Aug 3, 2016 · 3 comments

Comments

@arei
Copy link

arei commented Aug 3, 2016

It appears as if the highWaterMark setting for the channel write stream cannot be configured. freshChannel() does take an options object that it gets highWaterMark from, but new Channel(), createChannel() and createChannelConfirm() do not take options nor pass options through to freshChannel().

Setting highWaterMark may be desirable in some high volume systems.

@AsidStorm
Copy link

AsidStorm commented Jan 29, 2021

Sadly no upvotes or changes in 5 years (

May be it helps someone, we use this code to increase high water mark:

const TestChannel = await connection.createChannel();
TestChannel.__proto__.allocate = function() {
 this.ch = this.connection.freshChannel(this, {highWaterMark: 50000});
 return this;
};
await TestChannel.close();

const channel = await connection.createChannel();

@cressie176
Copy link
Collaborator

Can anyone confirm my understanding of what setting the high watermark it actually does please? From the node docs

The highWaterMark option is a threshold, not a limit: it dictates the amount of data that a stream buffers before it stops asking for more data. It does not enforce a strict memory limitation in general. Specific stream implementations may choose to enforce stricter limits but doing so is optional.

I understand this to mean that setting the high watermark will not block writes. However, it is possible the application code using amqplib implements such a mechanism when channel.publish returns false to indicate the buffer is saturated. Is this correct?

@cressie176
Copy link
Collaborator

I've created a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants