TLSSocket and Highwater marks question #51082
Unanswered
constantind
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
In nodejs 18.18.2 im trying to measure the activity of WritableStream by looking at the _writableState of the TLSSocket from server.on("upgrade", (req,socket,head)), where the websocketserver sender (https://github.com/websockets/ws/blob/master/lib/sender.js#L469) is writing to in order to find when it does actually push to the kernel buffers as docs suggests it may not be immediately. I could not find any easy way to debug or diagnose this, so I decided to log the writable state by increasing or decreasing the highWaterMark on the writable socket, to my surprise the _writableState does not change and always stays like this:
on server:
Later writing using AsyncIterator onNext method and websocket is created from the latest WebSocket.Server.completeUpgrade:
next call chain for the socket write: https://github.com/websockets/ws/blob/master/lib/sender.js#L469
Adding onNext method above logs the _writetableState:
Next to simulate reading chunks of 4MB and emitting into the AsyncIterator, also 1MB or 16MB and i was expecting to see at least once needDrain: true or lengh:0 to change in order to understand when it is in fact written to the kernel and how much does it write.
It appears that changing the default highwater mark does work on the same socket since i can see improvement in throughput only at 256k and 512k and lower network throughput otherwise but the writable state never changes.
Is this intended or i'm doing something wrong?
Beta Was this translation helpful? Give feedback.
All reactions