- 使用 CPU 和記憶體使用率資料來測量多人遊戲伺服器的資源需求,以便正確計算特定虛擬機器 SKU (類型) 上最佳的遊戲伺服器數目
- 使用網路計數器偵測不規則的網路環境,例如嘗試的 DDoS 攻擊或其他網路壅塞
使用方式
根據組建的建立方式,可以透過兩種方式為組建啟用 VM 計量:- 使用 Game Manager,您可以在 Game Manager 的 “New Build” 頁面上啟用 “Virtual machine metrics” 核取方塊。
- 使用 PlayFab 多人遊戲伺服器 API,您可以在下列 API 物件中將 IsEnabled 屬性設定為 TRUE。
- 對於使用容器的 Windows 組建,CreateBuildWithManagedContainer API 呼叫中的 InstrumentationConfiguration
- 對於處理序型 Windows 組建,CreateBuildWithProcessBasedServer API 呼叫中的 InstrumentationConfiguration
- 對於 Linux 組建,CreateBuildWithCustomContainer API 呼叫中的 LinuxInstrumentationConfiguration
Windows
在 Windows 上,VM 計量收集是現有 PlayFab 容器/處理序協調器 (稱為 VmAgent) 的一項功能。VmAgent 會定期 (每 10 秒) 執行一項工作,查詢下列系統效能計數器。- Available MBytes
- % Processor Time
- % User Time
- Disk Reads/sec (針對磁碟機 D:)
- Disk Writes/sec (針對磁碟機 D:)
- Bytes Received/sec
- Bytes Sent/sec
Linux
在 Linux 上,我們使用開放原始碼的 telegraf 代理程式來收集和處理計量。Telegraf 每 10 秒收集一次計量,並每 60 秒將其發出至我們的內部收集器代理程式。如需參考,您可以在下方查看我們所使用之 telegraf.conf 設定檔的內容。如需詳細資訊,請前往官方 telegraf 文件。 我們也使用名為telegraf-geneva-processor 的內部公用程式,針對計數器層級計量 (例如 net_bytes_recv 計量) 發出差異值。發出差異值而非實際計數器值,可在提供的 Game Manager 圖表中產生更好的視覺效果。
- cpu_usage_system
- cpu_usage_user
- memory_available_percent
- net_bytes_recv_diff (eth0 接收的網路位元組)
- net_bytes_sent_diff (eth0 傳送的網路位元組)
- diskio_reads_diff (sdb 的讀取次數)
- diskio_writes_diff (sdb 的寫入次數)
