Just a second...

Client throttling

Throttling is a method of ensuring that the Diffusion™ server limits (throttle) the volume of messages it transmits to a client within a specified period of time. This can be used to limit bandwidth usage or to prevent more messages being sent to a client than it can cope with.

How does throttling work?

Throttling is applied to a client queue so that the number or volume of messages sent to that client is restricted. Diffusion only dequeues a message to send to a client if that client has not breached its throttling limit.

Throttle types;

  • Messages per second (Only a specified number of messages are sent every second.)
  • Bytes per second (Only a specified number of bytes are sent every second)
  • Message interval (A single message is sent every n milliseconds.)
  • Buffer interval (A full output buffer (or the equivalent of) is sent every n milliseconds)
Figure 1. Normal and throttled client queues
The first image shows normal message sending where messages are sent one after another with no breaks. The second image shows an example of throttled message sending where three messages are sent then there is a 200ms break before another three messages are sent and so on.

Enabling throttling

Throttling can be enabled on a client-by-client basis from within the publisher.

To throttle a Client.throttle method which allows you to specify the type of throttling and a limit. A clientThrottler reference is returned.

If the throttle method is called for a client that is already throttled, it has the effect of removing the old throttler and adding a new one.

Call the Client.removeThrottler method to stop throttling.

The Client.isThrottling method can be used to determine whether a client is currently throttled and, if it is, the getThrottler method can be used to determine the type of throttling and the current limit.