Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Change udp memory allocation scheme from uv_buf_init to slab allocation. #2522

Closed
wants to merge 1 commit into from

Conversation

mrb
Copy link

@mrb mrb commented Jan 12, 2012

Takes slab allocation scheme from stream_wrap. Discussed with @ry and @bnoordhuis in IRC. This produced demonstrably better memory usage for a high volume of packets. This has been raised in #2468 amongst other issues. Please see this gist: https://gist.github.com/68890a9ae60e6b0f3bc0 for log output and test files.

@bnoordhuis
Copy link
Member

Having stream_wrap.cc and udp_wrap.cc share code would be preferable. Can you move the static variables into a struct? That way, sharing slabs (or not) between streams and UDP is easy to tweak.

@mrb
Copy link
Author

mrb commented Jan 12, 2012

@bnoordhuis The only reason I kept them separate was because @ry recommended that as an easy first step, since it seems to be a point of contention what will happen with the udp_wrap code. Additionally I can see some other potential advantages of not tying the implementations to each other -- soon we'll have configurable slabs, etc., where a few lines of duplicated code isn't going to kill anyone.

@bnoordhuis
Copy link
Member

Memory usage is indeed more stable and raw throughput doesn't seem to suffer. Thanks Michael, landed in bd9fa2e.

@bnoordhuis bnoordhuis closed this Jan 12, 2012
@mrb
Copy link
Author

mrb commented Jan 12, 2012

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants