for 13K users I have the following memory dump. I will paste the top 7 consumers. Netty seems to consume too much memory. Is this normal ?
(Netty Version:3.2.7, implementing IdleStateAwareChannelUpstreamHandler,Total Memory Netty Memory Usage:2.5GB minimum )
num #instances #bytes class name
----------------------------------------------
1: 23086640 923465600 org.jboss.netty.util.internal.ConcurrentHashMap$Segment
2: 28649817 916794144 java.util.concurrent.locks.ReentrantLock$NonfairSync
3: 23086640 554864352 [Lorg.jboss.netty.util.internal.ConcurrentHashMap$HashEntry;
4: 118907 275209504 [I
5: 5184704 207388160 java.util.concurrent.ConcurrentHashMap$Segment
6: 5184704 130874832 [Ljava.util.concurrent.ConcurrentHashMap$HashEntry;
7: 1442915 115433200 [Lorg.jboss.netty.util.internal.ConcurrentHashMap$Segment;
It looks like the memory usage is not normal.
Here are some facts about Netty internal memory usage
One channel has two
ReentrantLocks, (one read lock,one write lock)Channel stores all channel references in a
org.jboss.netty.util.internal.ConcurrentHashMapinternally, and automaticallyremoves on close (This is to assign unique channel ids).
ChannelGroup stores channel references in a
org.jboss.netty.util.internal.ConcurrentHashMapon add() and automatically removes on close.There will be one
ConcurrentHashMap$HashEntryper item stored inorg.jboss.netty.util.internal.ConcurrentHashMap.so you can calculate the expected memory usage, if your handlers are not leaking any references.