GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||
GeezerVison is showing github.com — Allocate bytebuf without magazine lock when threads get collisions by laosijikaichele · Pull Request #14594 · netty/netty Conversation
|
|
The computer's JMH results comparison between 4.1-branch and current PR: jmh.morethan Overall, the current PR has around
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@laosijikaichele while the numbers look good in general I wonder if it might also cause more churn (and fragmentation) in general as we might not be able to full the "current" chunk before trying to use the nextInLine or the central queue. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I shared the same exact concerns as @normanmaurer in the previous pr (although not so clearly explained, so sorry for that...) since we use the chunk for a single allocation - I'll check today if I can get some cycles to work on this |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
will it cause OOM with long time stress testing ?@laosijikaichele ,eg 2 days |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This PR mainly focused on the thread collision cases when multiple threads get raced on the same magazine, which means it only take effect when the thread collision happens, at that moment, the priority of reducing the race condition becomes more important than for example 'fragmentation' concern, IMHO. In addition, based on the previous benchmark, it seems complement the sudden performance downgrade for some size allocations(when size is |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
this is still happening? I remember a fix from @normanmaurer which could affect such |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I have not checked it recently. Just now have done a quick benchmark for current 4.1-branch and current-PR:
@franz1981 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
We should profile -prof gc to make sure of it; but in case it is not reproducible I believe is due to @normanmaurer changes |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I think this PR is unrelated to the OOM issue. But it will be better if we have a chance to do a long time stress testing to see the memory effect. I will try to figure a way to do it when have some time. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Just popped up an idea, we also can make the calling to 'allocateWithoutLock' switchable, which means if the 'adaptive' is in an 'eager' mode, it will call 'allocateWithoutLock' when thread collisions happened, otherwise it will continue to loop. This can be done by add a simple configurable Boolean flag. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Done a benchmark to cover more 'size' cases, which uses The comparison results between '4.1-branch' and this PR: jmh-morethan I may do more benchmarks to cover more 'size' cases this week, if have some time. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@franz1981 did you have time to look into this one ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@normanmaurer not yet, hope these days or max next week 🙏 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
@franz1981 nice… keep me posted please |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The change per se looks good since it allows some progress, instead of just spinning.
What's good thou is that it still try to be somehow "local" to the preferred magazine, trying the others as last resort.
I haven't yet been able to reproduce your numbers (with the same degree of success) - but is more due to unstable machines on my side - hope tomorrow to give it a spin in the lab.
Separate question: what do you think about adding a configuration benchmark parameter like
@Benchmark @Threads(32) public boolean allocateReleaseHeapAdaptive() { ByteBuf buf = adaptiveAllocator.heapBuffer(size); // this is useful to capture the case where a buffer is stolen // from too many other threads which already own it, since the RWO requires // bringing it in the local cache and invalidate other caches - if shared if (writeBuffer) { buf.setZero(0, size); } return buf.release(); }
since it should help to account for cases in which the allocator is better to keep local allocations, since that writing the buffer, in case has been shared with others cores, will likely cause additional cache coherency traffic.
Hopefully, writing such a small buffer (we can decide to always write no more than 128 bytes, regardless the allocation size) won't impact the ability to highly contend while allocating.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, I don't quite understand it, would you please share the full JMH test code, to let me better understand it? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…etty#14594) This PR continued from netty#14534 which was mis-closed. --------- Co-authored-by: laosijikaichele <laosijikaichele> Co-authored-by: Norman Maurer <[email protected]>
…14594) (#14729) This PR continued from #14534 which was mis-closed. Co-authored-by: old driver <[email protected]> Co-authored-by: Norman Maurer <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.