Table of Contents

Class ServerTrafficBreakdown

Namespace
FishMMO.Server.Implementation
Assembly
FishMMO.Server.dll

Each connection's outbound game traffic broken down by message type, logged once per interval: which broadcast, which behaviour's RPCs or sync types, the prediction state updates (reconcile), spawns, and so on, with bytes and messages per second. A measuring tool for the bandwidth budget, off unless TrafficBreakdownSeconds is set in the server's configuration.

public sealed class ServerTrafficBreakdown
Inheritance
ServerTrafficBreakdown
Inherited Members

Remarks

What it counts. Every message FishNet queues for a client (FishNet.Managing.Transporting.TransportManager.OnServerMessageQueued), per recipient, at the size FishNet wrote it, before bundling. So the totals are the game data: the transport's own cost on top (FishNet's bundle header, QUIC, UDP, IP) is what the wire counters measure, and the difference between the two is the overhead.

How a message is named. From its header alone, never its body: the PacketId (two bytes, first); for a broadcast, its type, from the two-byte key FishNet derives from the type's name; for a message about one behaviour (RPCs, sync types), the behaviour's class, from the object id and component index that follow the PacketId. An RPC sent through an RPC link has no PacketId: its first two bytes are the link index FishNet gave that one behaviour's RPC (allocated down from 65535), so it is resolved through the spawned behaviours' link tables and counted as the RPC type and behaviour it stands for. A header that does not read cleanly is counted under its PacketId alone.

Cost when on. One dictionary update per message per recipient on the main thread, no allocation in steady state. Off, the hook is null and FishNet pays one branch per message.

Properties

LongestReindexMilliseconds

Longest FishMMO.Server.Implementation.ServerTrafficBreakdown.IndexRpcLinks() since the last ResetLongestReindex(), milliseconds.

public static double LongestReindexMilliseconds { get; }

Property Value

double

Methods

BeginWindow(NetworkManager)

Starts a one-off measurement window, whatever the configuration says (the timed /admin simulate uses it). Counts until FinishWindow(int, List<string>).

public static ServerTrafficBreakdown BeginWindow(NetworkManager networkManager)

Parameters

networkManager NetworkManager

Returns

ServerTrafficBreakdown

FinishWindow(int, List<string>)

Ends a window from BeginWindow(NetworkManager): the full report (every connection's top message types) and a short summary, one line per real player plus the top kinds across all of them, each line short enough for chat.

public string FinishWindow(int topKinds, List<string> summary)

Parameters

topKinds int
summary List<string>

Returns

string

ResetLongestReindex()

Starts a new measurement of LongestReindexMilliseconds.

public static void ResetLongestReindex()

Stop()

Stops counting.

public void Stop()

TryStart(IServer<INetworkManagerWrapper, NetworkConnection, IServerBehaviour>)

Starts the breakdown when the configuration asks for it (TrafficBreakdownSeconds above 0), else returns null.

public static ServerTrafficBreakdown TryStart(IServer<INetworkManagerWrapper, NetworkConnection, IServerBehaviour> server)

Parameters

server IServer<INetworkManagerWrapper, NetworkConnection, IServerBehaviour>

Returns

ServerTrafficBreakdown