This document is about: SERVER 5
SWITCH TO

5.0 BETA to 5.0 RC1 Update Guide

主要更改概述

本指南適用於從v5.0 BETA更新到v5.0 RC1。 除了CounterPublisher(應用程序、項目和DLLs)被棄用並從SDK中刪除外,主要是配置的變化。

PhotonServer.config 更改

  • 我們現在推薦使用新的語法來定義伺服器應用置入。 之前:

    XML

    <Configuration>
      <LoadBalancing>
      </LoadBalancing>
    </Configuration>
    

    之後:

    XML

    <Configuration>
      <Instance Name="LoadBalancing">
      </Instance>
    </Configuration>
    

HTTP Listeners

WebSocketListeners (和其他HTTP Listeners)已經改變了語法。

之前(v5 BETA):

XML

    <WebSocketListeners>
      <WebSocketListener
        IPAddress="0.0.0.0"
        Port="9090"
        DisableNagle="true"
        InactivityTimeout="10000"
        OverrideApplication="Master">
      </WebSocketListener>
      <WebSocketListener
        IPAddress="0.0.0.0"
        Port="9091"
        DisableNagle="true"
        InactivityTimeout="10000"
        OverrideApplication="Game">
      </WebSocketListener>
    </WebSocketListeners>

更改後(v5):

XML

    <HTTPListeners>
      <HTTPListener
        Name="*:[PORT]::Master"
        IPAddress="0.0.0.0"
        Port="9090"
        DisableNagle="true"
        InactivityTimeout="10000">
        <Routing>
          <Route 
            Url="/+" 
            OverrideApplication="Master"
            PeerType="WebSocket"
            Counters="false" />
          <Route Url="/photon/m" Ping="true" Counters="false"/>
        </Routing>
      </HTTPListener>
      <HTTPListener
        Name="*:[PORT]::Game"
        IPAddress="0.0.0.0"
        Port="9091"
        DisableNagle="true"
        InactivityTimeout="10000"
        AppDataInactivityTimeout="15000">
        <Routing>
          <Route 
            Url="/+" 
            OverrideApplication="Game"
            PingEvery="2000" 
            PeerType="WebSocket"
            Counters="false" />
          <Route Url="/photon/g" Ping="true" Counters="false"/>
        </Routing>
      </HTTPListener>
      <HTTPListener
        Name="*:[PORT]::NameServer"
        IPAddress="0.0.0.0"
        Port="9093"
        DisableNagle="true"
        InactivityTimeout="10000"
        AppDataInactivityTimeout="15000">
        <Routing>
          <Route 
            Url="/+" 
            OverrideApplication="NameServer"
            PeerType="WebSocket"
            Counters="false" />
          <Route Url="/photon/n" Ping="true" Counters="false"/>
        </Routing>
      </HTTPListener>
    </HTTPListeners>

LoadBalancing 配置更改

文件名稱的更改

首先,最明顯的區別是,現在每個服務器應用程序都有自己的配置文件,其名稱格式如下: "{application_name}.xml.config"。 這對Master和GameServer應用程序來說尤其重要,它們過去默認共享相同的文件名和內容:"Photon.LoadBalancing.dll.config"。 該文件的內容現在被分割成兩個文件。

  • "deploy\LoadBalancing\Master\bin\Master.xml.config"
  • "deploy\LoadBalancing\GameServer\bin\GameServer.xml.config"

以下是配置文件的列表。

Master

更改前 (v5 BETA):

"deploy\LoadBalancing\Master\bin\Photon.LoadBalancing.dll.config"

更改後 (v5):

"deploy\LoadBalancing\Master\bin\Master.xml.config"

GameServer

更改前 (v5 BETA):

"deploy\LoadBalancing\GameServer\bin\Photon.LoadBalancing.dll.config"

更改後 (v5):

"deploy\LoadBalancing\GameServer\bin\GameServer.xml.config"

NameServer

更改前 (v5 BETA):

"deploy\NameServer\bin\Photon.NameServer.dll.config"

更改後 (v5):

"deploy\NameServer\bin\NameServer.xml.config"

結構更改

第二個重要的更改是,配置文件有了新的結構。

舊的文件結構:

XML

<?xml version="1.0"?>
<configuration>
  <configSections>
    <!-- sections defined here -->
  </configSections>
  <applicationSettings>
     <!-- app settings -->
  </applicationSettings>
  <!-- other settings -->
  <startup>
  </startup>
</configuration>

新的文件結構:

XML

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <Photon>
    <!-- all settings here -->
  </Photon>
</configuration>

注意底部<Photon>元素。

一些舊的配置部分(XML元素)不再需要:

  • <configSections>
  • <applicationSettings>
  • <startup>
  • <runtime>
  • <CounterPublisher>

一些元素被重新命名:

  • <Photon.LoadBalancing.Common.CommonSettings> 更改成<LoadBalacing>
  • <Photon.Common.Authentication.Settings> 更改成 <Authentication>
  • <Photon.LoadBalancing.MasterServer.MasterServerSettings> 更改成<Master>
  • <Photon.LoadBalancing.GameServer.GameServerSettings> 更改成<GameServer>
  • <Photon.NameServer.Settings> 更改成 <NameServer>
  • <WebRpcSettings> 更改成 <WebRpc>
  • <AuthSettings> 更改成 <CustomAuth>

另外,現在每個設置節點都有一個與設置匹配的自定義名稱,而不是以前的通用格式。 這適用於所有元素,除了<WebRPC>(以前是<WebRpcSettings>)和<CustomAuth>(以前是<AuthSettings)沒有改變。

舊的節點設置格式:

XML

<setting name="SettingName" serializeAs="String">
    <value>SettingValue</value>
</setting>

新的節點設置格式:

XML

<SettingName>SettingValue</SettingName>

下面是每個文件的更詳細的更改明細:

Master

舊的文件結構:

XML

<?xml version="1.0"?>
<configuration>
  <configSections>
    <!-- sections defined here -->
  </configSections>
  <applicationSettings>
    <Photon.LoadBalancing.Common.CommonSettings>
    </Photon.LoadBalancing.Common.CommonSettings>
    <Photon.Common.Authentication.Settings>
    </Photon.Common.Authentication.Settings>
    <Photon.LoadBalancing.MasterServer.MasterServerSettings>
    </Photon.LoadBalancing.MasterServer.MasterServerSettings>
  </applicationSettings>
  <Photon>
    <CounterPublisher>
    </CounterPublisher>
  </Photon>
  <WebRpcSettings>
  </WebRpcSettings>
  <startup>
  </startup>
</configuration>

新的文件結構:

XML

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <Photon>
    <LoadBalancing>
    </LoadBalancing>
    <Authentication>
    </Authentication>
    <Master>
      <S2S>
      </S2S>
      <GS>
      </GS>
      <Limits>
        <Inbound>
        </Inbound>
        <Lobby>
        </Lobby>
      </Limits>
    </Master>
    <WebRpc>
      <HttpQueueSetting>
      </HttpQueueSettings>
    </WebRpc>
  </Photon>
</configuration>

GameServer

舊的文件結構:

XML

<?xml version="1.0"?>
<configuration>
  <configSections>
    <!-- sections defined here -->
  </configSections>
  <applicationSettings>
    <Photon.LoadBalancing.Common.CommonSettings>
    </Photon.LoadBalancing.Common.CommonSettings>
    <Photon.Common.Authentication.Settings>
    </Photon.Common.Authentication.Settings>
    <Photon.LoadBalancing.MasterServer.GameServerSettings>
    </Photon.LoadBalancing.MasterServer.GameServerSettings>
  </applicationSettings>
  <Photon>
    <CounterPublisher>
    </CounterPublisher>
  </Photon>
  <WebRpcSettings>
  </WebRpcSettings>
  <startup>
  </startup>
</configuration>

新的文件結構:

XML

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <Photon>
    <LoadBalancing>
    </LoadBalancing>
    <Authentication>
    </Authentication>
    <GameServer>
      <S2S>
      </S2S>
      <Master>
      </Master>
      <Limits>
        <Inbound>
          <EventCache>
          </EventCache>
          <Properties>
          </Properties>
          <Operations>
          </Operations>
        </Inbound>
      </Limits>
      <HttpQueueSetting>
      </HttpQueueSettings>
    </GameServer>
    <WebRpc>
      <HttpQueueSetting>
      </HttpQueueSettings>
    </WebRpc>
  </Photon>
</configuration>

NameServer

更改(重命名/替換)<AuthSettings>節點為<CustomAuth>,同時保持相同的屬性/特性值。

舊的文件結構:

XML

<?xml version="1.0"?>
<configuration>
  <configSections>
    <!-- sections defined here -->
  </configSections>
  <applicationSettings>
    <Photon.NameServer.Settings>
    </Photon.NameServer.Settings>
    <Photon.Common.Authentication.Settings>
    </Photon.Common.Authentication.Settings>
  </applicationSettings>
  <AuthSettings>
  </AuthSettings>
  <startup>
  </startup>
  <runtime>
  </runtime>
</configuration>

新的文件結構:

XML

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <Photon>
    <NameServer>
    </NameServer>
    <Authentication>
    </Authentication>
    <CustomAuth>
      <HttpQueueSetting>
      </HttpQueueSettings>
    </CustomAuth>
  </Photon>
</configuration>

Plugins

新增一個<Configuration></Configuration>封裝元素,如下:

XML

<Configuration>
  <PluginSettings Enabled="True">
    <Plugins>
      <!-- custom plugin settings here -->
    </Plugins>
  </PluginSettings>
</Configuration>

HttpQueue設置

HttpQueue被用於所有的HTTP(出站)。 所以把序列的相關設置歸入一個組是有意義。 這組設置用於GameServer、WebRPC和CustomAuth設置(作為一個子組)。 大部分設置在第四版中已經有了,但現在它更有組織性(新結構),更乾淨,更一致(命名)。

  • HttpRequestTimeout: 序列可以響應HTTP等待多長時間(以毫秒為單位)。
  • LimitHttpResponseMaxSize: 允許HTTP響應有效載荷的最大尺寸。
  • MaxBackoffTime: 重試發送HTTP請求時的回退閾值。
  • MaxConcurrentRequests: 允許的最大的HTTP請求。
  • `MaxErrorRequests': 在處理序列請求時,可能發生的最大錯誤數。 如果達到了,HttpQueue將斷開連接(清除所有等待請求並拒絕接收),然後在ReconnectInterval後恢復。
  • MaxQueuedRequests: 可以等待的最大請求數。
  • MaxTimedOutRequests: 在序列中超時等待處理的請求的最大數量。 如果達到了,HttpQueue將斷開連接(清除所有等待的請求並拒絕接收),然後在ReconnectInterval後恢復。
  • QueueTimeout: 如果一個請求在HttpQueue中停留的時間超過了QueueTimeout毫秒,它將被自動刪除。
  • ReconnectInterval。在恢復HTTP請求的處理之前,序列需要等待多長時間(以毫秒計)。

LoadBalancer 與 Workload 配置更改

Workload 配置更改

舊的結構:

XML

<?xml version="1.0" encoding="utf-8" ?>
<FeedbackControlSystem>
  <FeedbackControllers>
      <!-- one or more controllers setup -->
  </FeedbackControllers>
</FeedbackControlSystem>

新結構(增加封裝<Configuration></Configuration> 元素/節點):

XML

<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
  <FeedbackControlSystem>
    <FeedbackControllers>
      <!-- one or more controllers setup -->
    </FeedbackControllers>
  </FeedbackControlSystem>
</Configuration>

LoadBalancer 配置更改

LoadBalancer 的配置文件是 "deploy\LoadBalancer.config".

XML

<?xml version="1.0" encoding="utf-8" ?>
  <LoadBalancer ReserveRatio="{ReserveRatio}" ValueUp="{ValueUp}">
    <LoadBalancerWeights>
      <Level name="0" Level="Level0" Value="{Value0}" />
      <Level name="1" Level="Level1" Value="{Value1}"/>
      <Level name="2" Level="Level2" Value="{Value2}"/>
      <Level name="3" Level="Level3" Value="{Value3}"/>
      <Level name="4" Level="Level4" Value="{Value4}"/>
      <Level name="5" Level="Level5" Value="{Value5}"/>
      <Level name="6" Level="Level6" Value="{Value6}"/>
      <Level name="7" Level="Level7" Value="{Value7}"/>
      <Level name="8" Level="Level8" Value="{Value8}"/>
      <Level name="9" Level="Level9" Value="{Value9}"/>
    </LoadBalancerWeights>
  </LoadBalancer>

新結構(增加封裝<Configuration></Configuration> 元素/節點):

XML

<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
  <LoadBalancer ReserveRatio="{ReserveRatio}" ValueUp="{ValueUp}">
    <LoadBalancerWeights>
      <Level name="0" Level="Level0" Value="{Value0}" />
      <Level name="1" Level="Level1" Value="{Value1}"/>
      <Level name="2" Level="Level2" Value="{Value2}"/>
      <Level name="3" Level="Level3" Value="{Value3}"/>
      <Level name="4" Level="Level4" Value="{Value4}"/>
      <Level name="5" Level="Level5" Value="{Value5}"/>
      <Level name="6" Level="Level6" Value="{Value6}"/>
      <Level name="7" Level="Level7" Value="{Value7}"/>
      <Level name="8" Level="Level8" Value="{Value8}"/>
      <Level name="9" Level="Level9" Value="{Value9}"/>
    </LoadBalancerWeights>
  </LoadBalancer>
</Configuration>
Back to top