Throttling sending notifications

Notifications sent by PubSub component may be sent in large batches, if you have a nodes with a lot of subscribers. In those cases, it is useful to throttle publications to improve behaviour and performance of other parts of Tigase XMPP Server.

To achieve that, PubSub throttles generate notifications to specified throughput. By default it is set to 5k packets for each CPU core available per second.

To set it to a different value, you can set limit property of publishExecutor bean to the expected number of publications per second, ie. 100000;

Note

This value is a number of total throughput, and will not be adjusted by the number of available CPU cores.

pubsub () {
    publishExecutor () {
        limit = 10000
    }
}

Publication rate is also adjusted to current memory usage on a 4 point scale adjusted to the value of two configuration options: highMemoryUsageLimit and criticalMemoryUsageLimit (with default values: 90% and 98% respectively): * normal - if memory usage is below highMemoryUsageLimit (i.e. below 90%) * high - memory usage less than halfway between highMemoryUsageLimit and veryHigh (i.e. between 90% and 94%) * veryHigh - memory usage more than halfway between highMemoryUsageLimit and veryHigh (i.e. between 94% and 98%) * critical - if memory usage is above criticalMemoryUsageLimit (i.e. above 98%)

It’s possible to adjust values of the high and critical limits in publisher bean:

pubsub () {
    publishExecutor () {
        highMemoryUsageLimit = 90
        criticalMemoryUsageLimit = 98
    }
}