RFR(L): JDK-8229517: Support for optional asynchronous/buffered logging

Liu, Xin xxinliu at amazon.com
Thu Mar 5 10:04:21 UTC 2020


Hi, hotspot reviewers,  

Could you take a look at my webrev?
Bug: https://bugs.openjdk.java.net/browse/JDK-8229517
Webrev: https://cr.openjdk.java.net/~xliu/8229517/01/webrev/

Previously, we had discussion at runtime-dev. https://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2020-February/038211.html
I would like to continue it because I redo my implementation on the tip of jdk and have made it a general solution. 

This webrev  provides <logging/asynclog.hpp> on apar with <log.hpp>. Even though it doesn’t touch any existing logging calls, it’s very possible to offload any callsite of logging to the asynchronous buffer.
My rationale is that we only need to redirect some time-critical logs to asynchronous buffer to dodge unexpected filesystem delay.  Eg. g1gc has some loggings at safepoint. We mitigate those long-tailed GC latencies rooted by filesystem writing to gclog. 

I got feedback from my our internal users. They have a concern about my approach of dynamic memory. Indeed, I gave up ringbuffer design in previous version and turn to use a dynamic allocated linkedlist.  If writing to filesystem stalls infinitely, JVM may implode because of memory usage.  I plan to solve it by adding a memory quota to the FIFO of logAsyncFlusher.hpp. It will start dropping early messages of  the FIFO if it has consumed too many free memories. Another potential improvement is changing the FIFO from mutex protected to lock-free.  It make sense if we redirect high volume of logging messages to it and mutex becomes hot.  

Thanks,
--lx
 




More information about the hotspot-runtime-dev mailing list