ChengbingLiu commented on PR #5246: URL: https://github.com/apache/hadoop/pull/5246#issuecomment-1376680930
> I spent a little time poking at `LogThrottlingHelper` to see what it would take to make it concurrent. I have a demonstration PR here: #5269. It's a bit complicated as it relies on functionality from `ConcurrentHashMap` as well as some atomic operations (mostly CAS). I now see what you mean. Thank you for the demo. This looks a bit too complex and unreadable. > I suspect it's likely overkill from an implementation complexity perspective since we don't _expect_ high contention on this class. I would say it probably makes sense to just use `synchronized`. WDYT? Yes, I think we should just use `synchronized`. In our production cluster, the call to `record(...)` happens about every millisecond (quite frequent already). According to _Java Performance, 2nd edition_ by Scott Oaks, "the cost of obtaining an uninflated lock is on the order of a few hundred nanoseconds", which is far less than the frequency. So it will not add too much performance penalty to use `synchronized`. I will upload a new version soon. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
