Rakkarsoft LLC

Statistics
How to read and interpret RakNet's statistical data

Statistical data is important for an online game because it lets you see where your traffic bottlenecks are. To this end, Raknet provides the structure RakNetStatistics which is returned by the GetStatistics() function present in the client, server, and peer. This structure is defined in Source/RakNetStatistics.h. The function StatisticsToString is also provided which will convert these statistics to a formatted buffer.

Terms used

CRC - Cyclic Redundancy Check data used with encrypted messages to detect tampering.
Encryption bits - Extra data in the header that is used solely for encryption headers and block alignment required for encryption.
Resend queue - A queue of reliable messages waiting for acknowlegements.
Split message - A block of data that is a segment of a larger block of data. The original message is split if it is larger than the MTU when accounting for headers from RakNet and UDP.
Message - A block of data to be sent.
Packet - A packet contains zero or more acknowlegements and zero or more messages, at least one of either.

Structure member variables

unsigned messageSendBuffer[NUMBER_OF_PRIORITIES];
Description: Number of messages waiting in the send buffer, at each priority level. Messages will wait when the current window size does not allow sending.
High values: You are sending more data than the available bandwidth.
Low values: You are sending less data than the available bandwidth.

unsigned messagesSent[NUMBER_OF_PRIORITIES];
Description: Number of messages that have been sent at each priority level.
High values: You are sending more data than the available bandwidth.
Low values: You are sending less data than the available bandwidth.

unsigned messageDataBitsSent[NUMBER_OF_PRIORITIES];
Description: How many bits of message data you have sent, at each priority level.

unsigned messageTotalBitsSent[NUMBER_OF_PRIORITIES];
Description: How many bits of total data has been sent, including RakNet's headers, at each priority level.

unsigned packetsContainingOnlyAcknowlegements;
Description: Number of packets that have been sent that contain only acknowlegements.
High values: If this number rises continually then the sender is flooding the recipient and has a window size that is too large. It could also mean a network spike when the sender window is too large.
Zero value: Normal performance.

unsigned acknowlegementsSent;
Description: Number of acknowlegements sent for reliable messages. Each reliable message recieved generates one acknowlegement, including resends.

unsigned acknowlegementsPending;
Description: Number of acknowlegements waiting to be sent for reliable messages. Each reliable message recieved generates one acknowlegement, including resends.
High values: The internal update thread has stopped running or is spiking so no data is being sent.
Zero value: Normal performance.

unsigned acknowlegementBitsSent;
Description: Total number of bits spent on sending acknowlegement packets.

unsigned packetsContainingOnlyAcknowlegementsAndResends;
Description: Number of packets that have been sent that contain only acknowlegements and resends.
High values: If this number rises continually then the sender is flooding the recipient at the same time the sender is not acknowleging packets. This could be poor network performance or could be when traffic is only flowing one way.
Low values: Normal performance.

unsigned messageResends;
Description: Number of messages that were not acknowleged in time so were resent. This is equivalent to packetloss.
High values: High packetloss, large ping variations, and/or internally RakNet is not waiting long enough before doing resends.
2% or less values: Normal performance.

unsigned messageDataBitsResent;
Description: How many bits of data, excluding RakNet's headers, were resent due to packetloss.

unsigned messagesTotalBitsResent;
Description: How many bits of data, including RakNet's headers, were resent due to packetloss.

unsigned messagesOnResendQueue;
Description: How many messages are waiting for the send window before they can be sent. This is the most useful statistic to see if you are sending faster than the reciever can handle..
Values greater than or equal to the window size: Send rate is exceeding bandwidth. The window size will increase as long as no packetloss occurs. Lag may be experienced. Values above zero but less than the window size: Normal performance, close to maximum throughput if accompanied by packetloss.
Zero: High performance, a lot of bandwidth still available.

unsigned numberOfUnsplitMessages;
Description: Number of messages sent that were under the MTU size, including RakNet's and the UDP headers.
High values: Normal performance.
Low values: Many messages are split. This will result in lag as messages wait to be reassembled.

unsigned numberOfSplitMessages;
Description: Number of messages sent that were over the MTU size, including RakNet's and the UDP headers.
High values: Many messages are split. This will result in lag as messages wait to be reassembled.
Low values: Normal performance.

unsigned totalSplits;
Description: How many splits have been performed.

unsigned packetsSent;
Description: How many packets have been sent, containing any type of data.
High values relative to messages sent: UDP headers will be taking a greater percentage of bandwidth. Manual Aggregation can improve bandwith usage.
Low values relative to messages sent: UDP headers will be taking a small percentage of bandwidth. Messages are aggreggated efficiently

unsigned encryptionBitsSent;
Description: Number of bits added to data solely due to usage of secure connections.
High values relative to message bits sent: Many small messages are being sent and encryption is using bandwith inefficiently.
Low values relative to message bits sent: Packets that are sent tend to be near the MTU size, using bandwidth efficiently.

unsigned totalBitsSent;
Description: Total number of bits sent - accounting for all data.

unsigned sequencedMessagesOutOfOrder;
Description: Number of sequenced messages that arrived out of order. This is equal to the number of sequenced messages dropped.

unsigned sequencedMessagesInOrder;
Description: Number of sequenced messages that arrived in order.

unsigned orderedMessagesOutOfOrder;
Description: Number of ordered messages that arrived out of order. Everytime this happens all ordered messages on that stream are delayed. If you encounter a lot of spiking this may be the cause.

unsigned orderedMessagesInOrder;
Description: Number of ordered messages that arrived in order.

unsigned packetsReceived;
Description: When using secure connections, the number of packets that passed the CRC check. Otherwise, the actual number of packets that arrived.
High values: Normal performance.

unsigned packetsWithBadCRCRecieved;
Description: When using secure connections, the number of packets that didn't pass the CRC check.
Non-zero values: This can occur to connection sequence packets arriving late. If the values rises consistently and rapidly, then someone is modifying packets during transmission.

unsigned bitsReceived;
Description: Number of bits that have been recieved while the connection is active, excluding bits with a bad CRC if secure connections are used.

unsigned bitsWithBadCRCReceived;
Description: Number of bits comprising messages with a failed CRC check.

unsigned acknowlegementsReceived;
Description: How many acknowlgements we recieved for message waiting to be resent. Values near the number of reliably sent messages indicate low packetloss.

unsigned duplicateAcknowlegementsReceived;
Description: How many acknowlgements we recieved for messages that have already been acknowleged - or were never reliable to begin with.
Non-zero values: The sender has high packetloss.

unsigned messagesReceived;
Description: Number of data messages that have arrived. This is always equal to or greater than the number of packets recieved. High values indicate good message aggreggation by the sender.

unsigned invalidMessagesReceived;
Description: How many data messages, other than acknowlgements, we recieved with corrupt internal information.
Non-zero values: Packet tampering or an internal send error.

unsigned duplicateMessagesReceived;
Description: How many data messages, other than acknowlgements, we recieved more than once.
High values: Poor network performance. Constantly rising values means the sender is sending faster than MAX_AVERAGE_PACKETS_PER_SECOND.
Low values: Normal performance.

unsigned messagesWaitingForReassembly;
Description: How many split messages are waiting to be completed.
High values: One or more very large messages have been sent at the same time, possibly accompanied by packetloss. Extremely high values may degrade performance.
Low values: Normal performance.

unsigned internalOutputQueueSize;
Description: How many messages are waiting to be passed out of the reliability layer.
Non-zero values: The update thread is spending all its time recieving messages and is not updating the reliability layer in a timely fashion. This could be due to handling too many clients on a slow server.

unsigned windowSize;
Description: How many reliable packets can be waiting for acknowlegements before futher sends are halted.

unsigned lossySize;
Description: The last window size that was used when a packet was lost.

unsigned long connectionStartTime;
Description: System time returned by getTime() when the connection was established.
See Also
Index