- Use CPU and memory utilization data to measure the resource needs of multiplayer servers, so you can properly calculate the optimal number of game servers on a specific Virtual Machine SKU (type)
- Use network counters to detect an irregular network environment, such as attempted DDoS attacks or other network congestion
Usage
VM metrics for a Build can be enabled in two ways, depending on how a Build is created:- Using Game Manager, you can enable the “Virtual machine metrics” checkbox on the “New Build” Game Manager page.
- Using the PlayFab Multiplayer Servers API, you can set the property IsEnabled to TRUE in the following API objects.
- InstrumentationConfiguration in the CreateBuildWithManagedContainer API call for a Windows Build with containers
- InstrumentationConfiguration in the CreateBuildWithProcessBasedServer API call for a process-based Windows Build
- LinuxInstrumentationConfiguration in the CreateBuildWithCustomContainer API call for a Linux Build
Windows
On Windows, VM metrics collection is a feature of the existing PlayFab container/process orchestrator called VmAgent. VmAgent periodically (every 10 seconds) runs a task that will query the following system performance counters.- Available MBytes
- % Processor Time
- % User Time
- Disk Reads/sec (for drive D:)
- Disk Writes/sec (for drive D:)
- Bytes Received/sec
- Bytes Sent/sec
Linux
On Linux, we’re using the open-source telegraf agent for collecting and processing metrics. Telegraf collects metrics every 10 seconds and emits them to our internal collector agent every 60 seconds. For reference, you can see the contents of the telegraf.conf configuration file we’re using below. For more details, go to the official telegraf docs. We’re also using an internal utility calledtelegraf-geneva-processor that emits the diff value for counter level metrics like the net_bytes_recv metric. Emitting the diff value instead of the actual counter value results in better visualization in the provided Game Manager graphs.
- cpu_usage_system
- cpu_usage_user
- memory_available_percent
- net_bytes_recv_diff (network bytes received for eth0)
- net_bytes_sent_diff (network bytes sent for eth0)
- diskio_reads_diff (number of reads for sdb)
- diskio_writes_diff (number of writes for sdb)
