public static long getNettyDirectMemoryUsage() {

    ByteBufAllocatorMetric metric =
      ((ByteBufAllocatorMetricProvider) PooledByteBufAllocator.DEFAULT).metric();
    return metric.usedDirectMemory();
  }
Returns the current amount of direct memory used by netty module.
hbase-server/src/main/java/org/apache/hadoop/hbase/util/DirectMemoryUtils.java