Reputation: 1155
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;
Upvotes: 1
Views: 2107
Reputation: 2486
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.ConcurrentHashMap
internally, and automatically
removes on close (This is to assign unique channel ids).
ChannelGroup stores channel references in a org.jboss.netty.util.internal.ConcurrentHashMap
on add() and automatically removes on close.
There will be one ConcurrentHashMap$HashEntry
per item stored in org.jboss.netty.util.internal.ConcurrentHashMap
.
so you can calculate the expected memory usage, if your handlers are not leaking any references.
Upvotes: 1