Project

General

Profile

Tigase actively disconnects from client with smack

w xy
Added about 2 months ago

config.tdsl:

watchdog_delay = 50000
watchdog_ping_type = 'xmpp'
watchdog_timeout = 30000

Dozens of seconds later,tigase close session:

tigase.cluster.SessionManagerClustered close closeConnection:10008@xmpp.server/Smack
tigase.cluster.SessionManagerClustered close closeConnection:10009@xmpp.server/Smack
Stream closed from: c2s@/192.168.0.31_5222_192.168.0.31_65078
Stream closed from: c2s@192.168.0.31_5222_192.168.0.31_65079

And, i send 10,000 messages via smack -> conn.sendStanzaWithResponseCallback, but only 3,000 messages were sent, and the rest were still in the blocking queue named ConcurrentLinkedQueue.


Replies (4)

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 2 months ago

I'm not sure what you were trying to achieve, but sending over 10000 messages one by one over a single connection is never a good idea and suggest that connected client might be a spammer and is using more resources than it should.

Due to that Tigase XMPP Server has a throttling mechanism which is enabled by default and by default it is set to allow 2500 messages per minute over a single XMPP client-to-server connection (or 20MB of data). If the limit is exceeded then the connection is dropped (closed). I suppose that your test client might not detect that connection was closed.

Added by w xy about 2 months ago

I want to push bulletins to everyone. What's a good way to send a lot of messages?

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 2 months ago

I would recommend reducing the number of messages sent in a period of time if possible. This will reduce the load on the server and backend database (messages sent to offline users needs to be stored in the offline storage).

Alternatively, you can:

  • increase throttling limit (it is described in Tigase XMPP Server documentation)
  • use component connection (it has higher limit)

However, I would recommend reducing the number of stanzas per second which you are sending as it will have the best results for your installation.

Added by w xy about 2 months ago

I couldn't hear the connection was closed by this:

conn.addConnectionListener(new MyConnectionListener(conn));

@Override
public void connectionClosed() {
log.info((null != conn ? conn.getStreamId() : "") + " ====> connectionClosed");
conn = null;
}

there is a another way to get it?

    (1-4/4)