Message Size Notes

by Dave Simmons

When making a multiuser movie, it's important to consider the size of the messages being sent between systems. This TechNote describes how to roughly calculate the number of bytes in each message.

Knowing the size of messages being sent and received by your movie can help prevent bottlenecks. You might consider, for example, sending messages less frequently or broadcasting data together to lower network traffic.

In general, fewer large messages work much better than more small messages. This is both due to decreased network overhead (less message header data being sent) and fewer messages to process in your lingo code.

Each message consists of the error code, server time stamp, subject, sender, recipient list and contents. There is also some additional message formating information. To get the message size, total all the components of the message and add another 16 bytes or so.

Here's some quick guidelines for the size of content values:

This is an example of a chat message that might be sent from a movie:
Header data   16
#errorCode 0 4
#timeStamp 123456 4
#subject "ChatMsg" 12
#sender "Myname" 10
#recipient "@ChatGroup" 14
#content "What is the weather like ?" 30

Total number of bytes

  90

To look at the message traffic on the server, you must consider how large the messages are, how often they are sent, and how they are distributed from the server.

The formula for the byte rate passing the server is:

msgRate = Rate of messages, in messages per second, per movie

bytesPerMsg = Number of bytes per message

groupSize = Group size the message is being distributed to

numUsers = Total number of users connected to the movie

Total bytes/second at the server = numUsers * msgRate * bytesPerMsg * (groupSize + 1)

The "+ 1" in the formula takes in account that the message is sent to the server and then redistributed to all the members in the group.

For our chat example, let's assume each user sends out a message every 20 seconds. The chat messages look like the one above, about 100 bytes each. Assume there is an average of 8 people in each chat group, and 65 people logged on total. That gives a traffic rate at the server of:

65 * 1/20 * 100 * (8 + 1) = 2925 bytes per second

At the client end, the formula for messages traffic is:

Total bytes/second at the client = (groupSize + 1) * msgRate * bytesPerMsg.

The "+1" in the formula takes in account that messages sent to the server are relayed and sent back to the same client.

In our above example, this means the data rate is:

(8 + 1) * 1/20 * 100 = 45 bytes per second.

For both cases, the data will not be a steady flow be come in somewhat random patterns. There will be peaks and lows in the data rate, raising and lowering the amount of information passing through the data pipe.