<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Interesting discussion. :-)<div><br></div><div>Ramki's observation of high context switches to me suggests active locking as a possible culprit. Fwiw, based on your discussion it looks like you're headed down a path that makes sense.</div><div><br></div><div>charlie...</div><div><br><div><div>On Oct 19, 2012, at 3:40 AM, Srinivas Ramakrishna wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br><br><div class="gmail_quote">On Thu, Oct 18, 2012 at 5:27 PM, Peter B. Kessler <span dir="ltr"><<a href="mailto:Peter.B.Kessler@oracle.com" target="_blank">Peter.B.Kessler@oracle.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When there's no room in the old generation and a worker has filled its PLAB to capacity, but it still has instances to try to promote, does it try to allocate a new PLAB, and fail? That would lead to each of the workers eventually failing to allocate a new PLAB for each promotion attempt. IIRC, PLAB allocation grabs a real lock (since it happens so rarely :-). In the promotion failure case, that lock could get incandescent. Maybe it's gone unnoticed because for modest young generations it doesn't stay hot enough for long enough for people to witness the supernova? Having a young generation the size you do would exacerbate the problem. If you have lots of workers, that would increase the amount of contention, too.<br>
</blockquote><div><br>Yes, that's exactly my thinking too. For the case of CMS, the PLAB's are "local free block lists" and the allocation from the shared global pool is<br>even worse and more heavyweight than an atomic pointer bump, with a lock protecting several layers of checks.<br>
<br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
PLAB allocation might be a place where you could put a test for having failed promotion, so just return null and let the worker self-loop this instance. That would keep the test off the fast-path (when things are going well).<br>
</blockquote><div><br>Yes, that's a good idea and might well be sufficient, and was also my first thought. However, I also wonder about whether just moving the promotion<br>failure test a volatile read into the fast path of the copy routine, and immediately failing all subsequent copies after the first failure (and indeed via the<br>
global flag propagating that failure across all the workers immediately) won't just be quicker without having added that much in the fast path. It seems<br>that in that case we may be able to even avoid the self-looping and the subsequent single-threaded fixup. The first thread that fails sets the volatile<br>
global, so any subsequent thread artificially fails all subsequent copies of uncopied objects. Any object reference found pointing to an object in Eden<br>or From space that hasn't yet been copied will call the copy routine which will (artificially) fail and return the original address.<br>
<br>I'll do some experiments and there may lurk devils in the details, but it seems to me that this will work and be much more efficient in the<br>slow case, without making the fast path that much slower.<br> <br></div>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I'm still guessing.</blockquote><div><br>Your guesses are good, and very helpful, and I think we are on the right track with this one as regards the cause of the slowdown.<br><br>I'll update.<br><br>-- ramki<br> <br>
</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im"><br>
<br>
... peter<br>
<br>
Srinivas Ramakrishna wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
System data show high context switching in vicinity of event and points at the futile allocation bottleneck as a possible theory with some legs....<br>
<br>
more later.<br>
-- ramki<br>
<br></div><div><div class="h5">
On Thu, Oct 18, 2012 at 3:47 PM, Srinivas Ramakrishna <<a href="mailto:ysr1729@gmail.com" target="_blank">ysr1729@gmail.com</a> <mailto:<a href="mailto:ysr1729@gmail.com" target="_blank">ysr1729@gmail.com</a>>> wrote:<br>
<br>
Thanks Peter... the possibility of paging or related issue of VM<br>
system did occur to me, especially because system time shows up as<br>
somewhat high here. The problem is that this server runs without<br>
swap :-) so the time is going elsewhere.<br>
<br>
The cache miss theory is interesting (but would not show up as<br>
system time), and your back of the envelope calculation gives about<br>
0.8 us for fetching a cache line, although i am pretty sure the<br>
cache miss predictor would probably figure out the misses and stream<br>
in the<br>
cache lines since as you say we are going in address order). I'd<br>
expect it to be no worse than when we do an "initial mark pause on a<br>
full Eden", give or<br>
take a little, and this is some 30 x worse.<br>
<br>
One possibility I am looking at is the part where we self-loop. I<br>
suspect the ParNew/CMS combination running with multiple worker threads<br>
is hit hard here, if the failure happens very early say -- from what<br>
i saw of that code recently, we don't consult the flag that says we<br>
failed<br>
so we should just return and self-loop. Rather we retry allocation<br>
for each subsequent object, fail that and then do the self-loop. The<br>
repeated<br>
failed attempts might be adding up, especially since the access<br>
involves looking at the shared pool. I'll look at how that is done,<br>
and see if we can<br>
do a fast fail after the first failure happens, rather than try and<br>
do the rest of the scavenge, since we'll need to do a fixup anyway.<br>
<br>
thanks for the discussion and i'll update as and when i do some more<br>
investigations. Keep those ideas coming, and I'll submit a bug<br>
report once<br>
i have spent a few more cycles looking at the available data and<br>
ruminating.<br>
<br>
- ramki<br>
<br>
<br>
On Thu, Oct 18, 2012 at 1:20 PM, Peter B. Kessler<br></div></div><div><div class="h5">
<<a href="mailto:Peter.B.Kessler@oracle.com" target="_blank">Peter.B.Kessler@oracle.com</a> <mailto:<a href="mailto:Peter.B.Kessler@oracle.com" target="_blank">Peter.B.Kessler@<u></u>oracle.com</a>>> wrote:<br>
<br>
IIRC, promotion failure still has to finish the evacuation<br>
attempt (and some objects may get promoted while the ones that<br>
fail get self-looped). That part is the usual multi-threaded<br>
object graph walk, with failed PLAB allocations thrown in to<br>
slow you down. Then you get to start the pass that deals with<br>
the self-loops, which you say is single-threaded. Undoing the<br>
self-loops is in address order, but it walks by the object<br>
sizes, so probably it mostly misses in the cache. 40GB at the<br>
average object size (call them 40 bytes to make the math easy)<br>
is a lot of cache misses. How fast is your memory system?<br>
Probably faster than (10minutes / (40GB / 40bytes)) per cache miss.<br>
<br>
Is it possible you are paging? Maybe not when things are<br>
running smoothly, but maybe a 10 minute stall on one service<br>
causes things to back up (and grow the heap of) other services<br>
on the same machine? I'm guessing.<br>
<br>
... peter<br>
<br>
Srinivas Ramakrishna wrote:<br>
<br>
<br>
Has anyone come across extremely long (upwards of 10<br>
minutes) promotion failure unwinding scenarios when using<br>
any of the collectors, but especially with ParNew/CMS?<br>
I recently came across one such occurrence with ParNew/CMS<br>
that, with a 40 GB young gen took upwards of 10 minutes to<br>
"unwind". I looked through the code and I can see<br>
that the unwinding steps can be a source of slowdown as we<br>
iterate single-threaded (DefNew) through the large Eden to<br>
fix up self-forwarded objects, but that still wouldn't<br>
seem to explain such a large pause, even with a 40 GB young<br>
gen. I am looking through the promotion failure paths to see<br>
what might be the cause of such a large pause,<br>
but if anyone has experienced this kind of scenario before<br>
or has any conjectures or insights, I'd appreciate it.<br>
<br>
thanks!<br>
-- ramki<br>
<br>
<br></div></div>
------------------------------<u></u>__----------------------------<u></u>--__------------<br>
<br>
______________________________<u></u>___________________<br>
hotspot-gc-use mailing list<br>
hotspot-gc-use@openjdk.java.__<u></u>net<br>
<mailto:<a href="mailto:hotspot-gc-use@openjdk.java.net" target="_blank">hotspot-gc-use@<u></u>openjdk.java.net</a>><br>
<a href="http://mail.openjdk.java.net/__mailman/listinfo/hotspot-gc-__use" target="_blank">http://mail.openjdk.java.net/_<u></u>_mailman/listinfo/hotspot-gc-_<u></u>_use</a><br>
<<a href="http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use" target="_blank">http://mail.openjdk.java.net/<u></u>mailman/listinfo/hotspot-gc-<u></u>use</a>><br>
<br>
<br>
<br>
</blockquote>
</blockquote></div><br>
_______________________________________________<br>hotspot-gc-use mailing list<br><a href="mailto:hotspot-gc-use@openjdk.java.net">hotspot-gc-use@openjdk.java.net</a><br>http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use<br></blockquote></div><br></div></body></html>