Addon Comm Throttling

''This writeup concerns managing total throughput of very large shared channels. It does not touch upon the maximum output rate for a single client. See ChatThrottleLib for more information on that subject.''

Message throttling is a complicated subject, because you have to limit both incoming and outgoing traffic while only having control of outgoing.

The number one goal to keep in mind is that background communications should not affect foreground game play.

The maximum incoming rate for chat is as such: p * r = T Where p is the amount of players communicating, r is the maximum rate, and T is the total incoming bytes per second.

Thus, looking at the extreme case of 40 raid members: 40 * r = T and consequently, r = T / 40

So in picking an arbitrary T that is sufficient to bear the load but not cause a great impact, T is 4000, and r is 100.

Despite it seeming low, a rate of 100 Bytes / second is not all that far-fetched. If you are transferring critical information, it should be sent in as small packets as possible, possibly with some compression mechanism.

Also, for raids, raid leaders have the privilege of 200 Bytes / second, and raid assistants 150 Bytes / second.

Instead of having guild, global, and raid on the same throttle, it is better to split them up into different throttles, to prevent a large global message from preventing a needed real time raid message.

Guild throttling
Unlike the raid channel, both Guild and Global channels should not be sending real time data back and forth, thus the need for such a high rate is not needed.

Thus, the formula I'll use to calculate the Guild and Global rates is this formula: Rp * Rr = Gp * Gr * C which translates to Gr = Rp * Rr / Gp / C

Where Rp is the likely maximum members in a raid (40),

Rr is the rate at which the average raid message is traveling (100 B/s),

Gp</tt> is the likely maximum members in a guild,

Gr</tt> is the rate at which the average guild message is traveling,

C</tt> is a constant to determine the need of real time messages.

Guilds have a varying number of members, with the average being around 61 members per guild. Some guilds have a much larger number, though, upwards of 300. The number I will use is Dunbar's number, which is roughly 150. Any guilds with an amount of members over this is unlikely to exist (and unlikely to persist).

The need for real time messages is very important in a raid, so I shall choose the arbitrary and simple number 2 to represent C, which means that real time messages are twice as important as normal messages).

So the numbers we have are:
 * Rp</tt> = 40 members
 * Rr</tt> = 100 B/s
 * Gp</tt> = 150 members
 * C</tt> = 2

So Gr = Rp * Rr / Gp / C translates to Gr = 40 * 100 / 150 / 2 so Gr = 13.33333333333333 -- and so on

So you can send about 13 bytes/second through the guild.

Note: you could send one giant 250-byte message to the global channel, you merely have to wait 20 seconds before you send your next message. In turn, if you send a 10-byte message, you only have to wait 1 second to send your next message.

If you are the guild leader, you should have the privilege of double that rate, at 26.66666 bytes/second.

Global throttling
Global messages are even more complicated and should be used with greatest care, since there are many players, who all want to get their voice heard.

I will use the same formula as above to determine the rate. Rp * Rr = Tp * Tr * C which translates to Tr = Rp * Rr / Tp / C

Where Rp</tt> is the likely maximum members in a raid (40),

Rr</tt> is the rate at which the average raid message is traveling (100 B/s),

Tp</tt> is the likely maximum members in the global channel,

Tr</tt> is the rate at which the average global message is traveling,

C</tt> is a constant to determine the need of real time messages. (2)

In a populated realm, the amount of members online on a single faction can reach 4000 (and possibly go beyond), so that shall be the value for Tp</tt>

So the numbers we have are:
 * Rp</tt> = 40 members
 * Rr</tt> = 100 B/s
 * Gp</tt> = 4000 members
 * <tt>C</tt> = 2

So Tr = Rp * Rr / Tp / C translates to Tr = 40 * 100 / 4000 / 2 so Tr = 0.5

So you can send 0.5 chars per second through the global channel. This may seem extremely small, but it is necessary.

Note: you could send one giant 250-char message to the global channel, you merely have to wait 500 seconds before you send your next message. In turn, if you send a 10-char message, you only have to wait 20 seconds to send your next message.