-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
RFC: Concurrency limit on zlib #1202
Comments
Refs: #804 |
I think the issue should be fixed upstream (Node.js core) using a different allocator but if we can work around the problem I'm open to it. cc: @websockets/admin |
If the origin of the problem comes from node, it would make sense to fix it there. But i'm not against landing a build-in queue in the mean time. |
STRML
added a commit
to STRML/ws
that referenced
this issue
Sep 11, 2017
STRML
added a commit
to STRML/ws
that referenced
this issue
Sep 11, 2017
STRML
added a commit
to STRML/ws
that referenced
this issue
Sep 11, 2017
Fixed by #1204. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using
permessage-deflate
is difficult on long-running servers due to nodejs/node#8871 (comment).I've spent some time with this subject and found that on Linux, whether or not Transparent Huge Pages is enabled, catastrophic memory fragmentation occurs and cannot be recovered from.
Unfortunately this is the case for any processes that queue up large numbers of jobs to zlib. The more concurrency you use, the more fragmentation.
I've measured this using the following script:
And here are the results:
To summarize:
zlib.deflate()
we see only 68 MB of RAM used.This manifests in horrible ways in production:
The above corresponds to a load spike, which compressed a very large number of messages.
If 'ws' is open to it, I'd like to open a PR integrating or creating a plugin (suggestions?) that uses queue or a similar library to limit zlib concurrency to a reasonable value.
I've opened this issue first to track the problem and see if others have seen it, and to determine if such a PR would be accepted.
The text was updated successfully, but these errors were encountered: