Using jxray (www.jxray.com), I've analyzed a heap dump of YARN RM running in a big cluster. The tool uncovered several inefficiencies in the RM memory. It turns out that one of the biggest sources of memory waste, responsible for almost 1/4 of used memory, is empty ConcurrentHashMap instances in org.apache.hadoop.conf.Configuration.updatingResource:
That is, there are 22118 empty ConcurrentHashMaps here, and they collectively waste ~905MB of memory. This is caused by eager initialization of these maps. To address this problem, we should initialize them lazily.