PubSub: Poor performance with lots of offline users.

Bill Hoo
Added almost 4 years ago

Hi there,

I'm new to PubSub stuff, and get poor performance on one of my test case with tigase-server-7.0.1-b3810.

  1. 10K users subscribed 'test-node-1'

  2. Only two users('user1' 'user2') are online, all of the rest are offline.

  3. 'user1' publish a message to 'test-node-1'.

What I expected is that 'user2' receives this msg almost in realtime,

but actually it takes too long, almost 15~25 seconds.

And when I check the database(MySQL), the content of table 'msg_history' is

incremented a lot, and its speed is about 100records/sec, does it slow down the whole server?

BTW, --debug mode was commented out.




--virt-hosts =


--comp-name-3 = pubsub

--comp-class-3 = tigase.pubsub.PubSubComponent

#--comp-class-3 =tigase.pubsub.cluster.PubSubComponentClustered

#--comp-name-4 = message-archive

#--comp-class-4 = tigase.archive.MessageArchiveComponent

--user-db = mysql

--user-db-uri = jdbc:mysql://localhost:3306/tigasedb?user=username&password=pwd

--new-connections-throttling = 5222:8192

--cm-traffic-throttling = xmpp:0:0:disc,bin:0:0:disc

--user-repo-pool-size = 25

--max-queue-size = 1000000



ENC="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8"


#GC="-XX:+UseBiasedLocking -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:ParallelCMSThreads=2 -XX:-ReduceInitialCardMarks"

#EX="-XX:+OptimizeStringConcat -XX:+DoEscapeAnalysis -XX:+UseNUMA"




JAVA_OPTIONS="${GC} ${EX} ${ENC} ${DRV} ${JMX_REMOTE_IP} -XX:+UseLargePages -XX:+UseBiasedLocking -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:ParallelCMSThreads=4 -server -d64 -Xms10G -Xmx10G -XX:PermSize=64m -XX:MaxPermSize=512m "


TIGASE_OPTIONS=" --property-file etc/ "

Replies (2)

Added by Bill Hoo almost 4 years ago

After searching in Tigase docs, I find this optimization on MySQL database [[]].

And it really worked, the performance is good now, same test case, there's just 1~2 seconds delay before 'user2' receives the msg.

Later I'll increments the test users to 100K~500K, see if the poor performance back again.

Thanks the Tigase team.


Added by Artur Hefczyc TigaseTeam almost 4 years ago

This is generally expected.

If you send thousands of messages to offline users and you have offline message archive enabled, then all messages go to the database to wait until users are back online. In such a case only the database is the bottleneck. If your database can store 10k records in 1 second than delays will be minimal.

Another way to avoid performance problems in such a case is to either make the PubSub to send notifications only to online subscribers or disable offline storage for messages. This way you avoid any database traffic and message delivery would be instant to online users.