server | v3 switch to v4  

Photon Server Config Settings

.

These are the the Photon configuration settings for Photon Server 3.x. Find them as PhotonServer.config file in the SDK.

.

.

Photon Version:3.x

.

Author:developer@photonengine.com

.

Last update:5/27/2014

.

.

Instance

.

Multiple instances are supported. Each instance has its own node in the config file. PhotonControl will currently only start "Instance1" but the .cmd files could be modified to start other instances.

.

.

SettingPhoton DefaultConfig DefaultDescription

.

ConfigNameOptional "ConfigName" value from config file if present it will be logged.

.

ReportOnJobFALSEIt causes photon to determine if it is running inside a win32 job object (something that is used by process starting code to place limits on what the process can do) and if so reports on the limits that are currently imposed.

.

LogFileLocationSets the path for logfiles. Default is the location where the server is started. Can be absolute or relative to the PhotonSocketServer.exe

.

EnablePerformanceCountersTRUEDetermines whether the server will enable its performance counters or not. The performance counter implementation creates a shared memory segment to allow the counter DLL to communicate with the server. To be able to create this shared memory segment requires that the user running the server has suitable privileges. If you wish to run the server without those privileges (and without publishing performance data) then you can set this value to "false".

.

MaxMessageSize512000Determines the maximum number of bytes that a UDP, TCP or WebSockets message might have that is received or sent by the server. If the message exceeds the MaxMessageSize limit, the client will be disconnected from the server. MaxMessageSize can be overwritten in the appropriate listener.

.

ShutdownTimeout30000When a Photon shutdown has not finished successfully after this timeout (in ms), the Photon process is forcibly killed.

.

DisplayNameAn optional display name for this instance, which is shown in Photon Control.

.

.

TCP

.

SettingPhoton DefaultConfig DefaultDescription

.

TCPBufferSize4096The size of buffer used during TCP data transfer. Note that this does not in any way restrict the message size. It's ideal to have the buffer size be slightly more than the average message size.

.

TCPBufferAllocatorPoolSize500The number of buffers used for TCP data transfer that are kept in the pool for later reuse. This is a classic trade of speed vs resources. The pooled buffers are faster to allocate but take up memory all the time.

.

StreamSocketAllocatorPoolSize250The number of TCP sockets that are kept in the pool for later reuse. This is a classic trade of speed vs resources. The pooled sockets are faster to allocate but take up memory all the time.

.

.

UDP/ENET

.

SettingPhoton DefaultConfig DefaultDescription

.

DatagramSocketAllocatorPoolSize1000The number of datagram sockets that are kept in the pool for later reuse. This is a classic trade of speed vs resources. The pooled sockets are faster to allocate but take up memory all the time.

.

PingIntervalMilliseconds1000The Ping interval is how often a ping is sent from server to client when no data is flowing. Sending pings adds load to the server and so this can be tuned; a larger value leads to less load on the server. The ENet protocol usually uses a fixed value for this parameter. Defaults to the ENet standard value of 500ms.

.

DataSendingDelayMilliseconds5The data sending delay is how long the server will wait to accumulate more data to send to the client in the same datagram. A larger value can lead to fewer datagrams being sent as more data can be put into a single datagram, however this also increases latency as the server waits longer before sending responses. If using the 'standard' ENet code then data is accumulated until a call to enethostflush() or enethostservice().

.

AckSendingDelayMilliseconds5The data sending delay is how long the server will wait before sending an ACK to the client. This allows it to potentially piggyback the ACK onto a data packet if a response packet is generated within the delay period. A larger value can lead to fewer datagrams being sent as an ACK can be put into the same datagram as a reply. This doesn't increase latency. If using the 'standard' ENet code then data is accumulated until a call to enethostflush() or enethostservice().

.

MinimumRetransmitTimeout200Enet retransmission times are calculated based on the accumulated RTT of the peer. This setting sets a minimum retransmission time. Peers with very low latency could want to retransmit before the value that this setting allows and will be delayed. This value allows you to reduce the speed at which data is retransmitted and reduce the load on the server. If you are sending reliable data and have low latency peers and require minimum latency then setting this value to anything but zero will likely increase latency and reduce the number of peers that you can support with given CPU resources.

.

ENETBufferAllocatorPoolSize5000The number of buffers that are kept in the pool for later reuse. This is a classic trade of speed vs resources. The pooled buffers are faster to allocate but take up memory all the time.

.

MinimumTimeout50005000The minimum amount of time before an Enet peer's lack of response causes a timeout disconnect. Note that the actual time is determined dynamically per peer based on the RTT history.

.

MaximumTimeout3000030000The maximum amount of time before an Enet peer's lack of response causes a timeout disconnect. Note that the actual time is determined dynamically per peer based on the RTT history.

.

ValidateCRCifPresentFALSEIf enabled: if the incoming datagram contains an optional CRC value, the checksum is validated. If the peer had been created with the CRC value present (indicated by a "CRC" flag in the UDP header that is set by the client library), all outbound datagrams that are sent to the client will contain the CRC value, too.

.

.

Udp/Enet Throtteling

.

SettingPhoton DefaultConfig DefaultDescription

.

PerPeerMaxReliableDataInTransit5120016384The maximum amount of reliable data that a peer can send and which the peer has not as yet received an ACK for. In bytes. Once this amount of data has been sent all future reliable data will be queued.

.

PerPeerTransmitRateLimitKBSec256256The maximum amount of data (reliable AND unreliable) that can be sent in a second (in KB). This can be used to limit the amount of data that a peer can send. When the limit is reached further reliable data is queued and unreliable data is dropped. The default, 12, is a purely arbitrary value that has no meaning and has NOT been carefully calculated to be in any way special.

.

PerPeerTransmitRatePeriodMilliseconds200How often we check the transmit rate limit. By default we check every 250ms (i.e. 4 times per second) and we scale the PerPeerTransmitRateLimitKBSec by 4 for each check. A smaller value makes the data flow more consistent, a larger value makes the flow more jerky but uses less server resources.

.

MaxQueuedDataPerPeer512000163840The maximum amount of reliable data that a peer can queue. Reliable data is queued when either the PerPeerMaxReliableDataInTransit or the PerPeerTransmitRateLimitKBSec limits are exceeded. Once this limit is exceeded all future reliable sends will return an error code.

.

.

DEBUGGING

.

SettingPhoton DefaultConfig DefaultDescription

.

ProduceDumpsTRUESwitch to enable or disable creation of "dump files" in case of a crash. Dump files are essential to find issues in the Photon Core.

.

DumpTypeFullDefines the type of crash dumps to write. The types are "Full", "Maxi" and "Mini" and they include less information from first to last but also require less space on the harddisk.

.

MaxDumpsToProduce10Configures how many dump files are written maximum. If the files are moved or deleted, new ones can be written.

.

.

IOPool

.

This thread pool handles all I/O operations such as datagram sending and reception, tcp read completions, etc. This pool can also handle Enet protocol operations if ENetThreadPool\OnlyDispatchTimers is set to "true". Once inbound data has been deblocked into commands it is sent to the "Business Logic" thread pool for passing into the CLR and managed code.

.

.

SettingPhoton DefaultConfig DefaultDescription

.

NumThreads2This value determines the number of threads used for socket I/O. A value of 4-8 tends to be good but you should profile your server to see what works best. Use the I/O thread performance counters to see when all I/O threads are busy when the server is under load. If set to 0 then the I/O Pool uses 2 x the number of CPU cores as the number of threads; whilst this works well for up to a dual core it isn't especially useful if the resulting number of threads is more than 8.

.

.

ThreadPool

.

This is the "Business Logic" thread pool. It's used for all CLR operations.

.

.

SettingPhoton DefaultConfig DefaultDescription

.

InitialThreads4This setting determines the number of threads that the thread pool starts with.

.

MinThreads4This setting determines the minimum number of threads that the thread pool will contain.

.

MaxThreads4This setting determines the maximum number of threads that the thread pool will contain. Note that if Initial, min and max are all the same then the pool is a static pool rather than a dynamic pool. Static pools are more efficient than dynamic pools as the work item dispatch process is optimised. Dynamic pools can grow and shrink as demand changes. If your work items are generally short lived and the pool rarely expands in general use then you can get a performance boost by setting the pool up as a static pool.

.

MaxDormantThreads4This setting determines the maximum number of threads that can be 'dormant', i.e. not currently performing work. Once the number of dormant threads exceeds this amount some threads will be shut down.

.

PoolMaintPeriod5000This setting determines how often the pool is maintained. The value is in milliseconds. A maintenance thread will wake up every X ms to check on and possibly shut down dormant threads.

.

DispatchTimeout100This setting determines when a new thread may be started. If a work item is dispatched and this number of milliseconds passes before a worker thread picks up the item and begins processing it then a new thread may be started.

.

.

ENetThreadPool

.

The Enet Thread Pool is one of three thread pools in the server. This is used for all Enet protocol operations (i.e. deblocking inbound datagrams, acking on and sending ACKs, dealing with periodic protocol events for peers; e.g. retransmission and ping generation).

.

.

SettingPhoton DefaultConfig DefaultDescription

.

InitialThreads2See ThreadPool.

.

MinThreads2See ThreadPool.

.

MaxThreads2See ThreadPool.

.

MaxDormantThreads5See ThreadPool.

.

PoolMaintPeriod5000See ThreadPool.

.

DispatchTimeout100See ThreadPool.

.

OnlyDispatchTimersFALSEIf set to true the only Enet timer operations use this pool. If set to false then all Enet operations (i.e. protocol level operations such as deblocking inbound data and processing ACKs etc) are dispatched to this pool.

.

.

Runtime

.

Defines the Photon Runtime behavior.

.

.

SettingPhoton DefaultConfig DefaultDescription

.

AssemblyPhotonHostRuntime, Culture=neutralThe details of the Photon Runtime assembly to use. Normal .Net assembly loading rules are used to locate the assembly. The assembly MUST be signed by the Exit Games Photon Runtime key and the PublicKeyToken part of the assembly name must NOT be specified as we add that on ourselves before we load the assembly.

.

CLRVersionBy default, the latest DotNet runtime is used to host Photon Applications. Per instance, this setting allows to load a select version. Values are "v4.0" or "v2.0" or complete versions with build numbers. Example: CLRVersion = "2.0"

.

EnableMDAFALSEEnables the managed debugging assistants. Configure these with a PhotonSocketServer.exe.mda.config file in the same directory as the exe.

.

TypePhotonHostRuntime
.PhotonDomain
Manager
The name of the type that is used as the Photon Runtime's domain manager. This type MUST be located in the assembly detailed by the Runtime value. MUST derive from PhotonHostRuntimeInterfaces.IPhotonDomainManager.

.

UnhandledExceptionPolicyIgnoreIgnoreIgnore, ReloadAppDomain, TerminateProcess

.

.

Applications

.

SettingPhoton DefaultConfig DefaultDescription

.

DefaultA default application to use if no application is specified.

.

PassUnknownAppsToDefaultAppTRUEIf true when an unknown application name is supplied the default application is used. If false then this is a fatal error which will terminate a connection.

.

.

Application

.

SettingPhoton DefaultConfig DefaultDescription

.

NameArbitrary name for the application, used for dispatch.

.

SharedDirectory"Shared"Used to contain 'shared' assemblies. WILL BE located under the Base Directory.

.

BaseDirectoryThis folder should contain a "bin" folder with all the application assemblies and config files, etc.

.

AssemblyDetails of the assembly to use. Normal .Net assembly loading rules are used to locate this assembly and it can contain a complete assembly specification string (including PublicKeyToken if requried).

.

TypeThe name of the type that will be loaded as the application. MUST derive from PhotonHostRuntimeInterfaces.IPhotonApplication.

.

EnableShadowCopyFALSEIf enabled then the CLR will create copies of the assembly files in a private directory when they are loaded. This allows you to overwrite the originals, for update, say. The copies are used until the application domain that's using them is shut down.

.

EnableAutoRestartFALSEIf enabled the app will restart automatically if files changes occur. A new copy of the application is started; existing connections to the old copy are allowed to continue until all connections disconnect at which point the app domain is unloaded. The IPhotonApplicationControl.OnStopRequested() method is called when the unmanaged code wishes to 'kindly' unload an app domain, the app could inform the clients at this point.

.

ForceAutoRestartTRUEFALSEForceAutoRestart, if set to "true", implies "EnableAutoRestart" but aborts all existing connections rather than waiting for them to disconnect.

.

RestartDelayMilliseconds1000Restarts due to file changes can be delayed with this setting.

.

WatchFiles""By default no "WatchFiles" entry means watch everything. Example: WatchFiles="dll;config;Lite.XML"

.

ExcludeFiles""By default no "ExcludeFiles" entry means exclude nothing. Example: ExcludeFiles="log4net.config"

.

StartTimeoutMilliseconds0Photon shuts down if the Application does not start in the configured amount of time. 0 = no timeout is applied.

.

StopTimeoutMilliseconds0Photon shuts down if the Application does not stop in the configured amount of time. 0 = no timeout is applied.

.

.

TCPListeners

.

TCPListener

.

SettingPhoton DefaultConfig DefaultDescription

.

IPAddress0.0.0.0The IP Address to listen on, e.g. 192.168.0.1 or 0.0.0.0 to listen on ALL interfaces.

.

Port45305051The port to listen on.

.

ListenBacklog150The size of the listen backlog queue. This affects the number of connections that can be established simultaneously; so, for example, if 151 clients attempt to connect at exactly the same time then the last one could be rejected. Note that each connection establishment attempt takes very little time and once the connection IS established the connection is not affected by the limit. So you can set the value to 10 and still have 10,000 concurrent active connections as long as no more than 10 attempt to connect at exactly the same time.

.

RecvBufferSize0The size of the TCP recv buffer used by the TCP stack. This is also used to determine the TCP window size (which is used by the TCP stack for flow control). Defaults to zero which means "don’t change" which causes the operating system's default value to be used.

.

SendBufferSize0The size of the TCP send buffer used by the TCP stack. Defaults to zero which means "don’t change" which causes the operating system's default value to be used.

.

MaxPendingWrites50Flow control setting: configures the max amount of pending writes in buffers (see TCPBufferSize).

.

MaxQueuedBuffers200Flow control setting:: configures the amount of buffers used to queue writes (see TCPBufferSize). More queueued buffers than pending writes means that we use less non-paged pool (a scarce resource) as only pending writes use non-paged pool.

.

DisableNagleTRUETRUEDetermines if Nagle's algorithm is in use on the connection. If set to true then Nagle is disabled and outbound TCP data will be sent as soon as it reaches the TCP stack. If set to false then Nagle is in operation and the TCP stack will attempt to colasce outbound data into fewer datagrams. Setting this setting to true might improve the latency of your TCP connections a little, at the expense of there being more datagrams sent.

.

InactivityTimeout50005000A time, in ms, which is allowed between receiving data on a connection. If this time is exceeded then the connection is deemed to be inactive and is aborted. To ensure that this timer doesn't fire inappropriately you should make sure that there is an inbound TCP message on each connection more frequently than the value set here. Set to zero to disable the inactivity timer.

.

DisconnectTimeout120000A time, in ms, which is allowed for the client to close the connection once the connection has been disconnected by the application.

.

OverrideApplicationCan be used to override the application used for this connector. The application selection sent by clients will be ignored. The value can be the name of any setup application.

.

DefaultApplicationDefines a default application for a Listener. This DefaultApplication is used, when a client tries to connect to a application that is not loaded. For this Listener, the DefaultApplication overrides the "Default" application set in the Applications node. The value can be the name of any setup application.

.

PolicyApplicationDefines the application to be used in case policy requests are sent to this listener. (Bug of some flash clients)

.

MaxInboundMessageSizeDetermines the maximum number of bytes that a message might have which is received by the server through this Listener. If the message exceeds the MaxInboundMessageSize limit, the client will be disconnected from the server. Default is the configured value in MaxMessageSize.

.

MaxOutboundMessageSizeDetermines the maximum number of bytes that a message might have which is sent by the server through this Listener. If the message exceeds the MaxOutboundMessageSize limit, the client will be disconnected from the server. Default is the configured value in MaxMessageSize.

.

CustomConnectMessageIsRequiredFALSEIf set to true, a custom prefix / suffix is required on each Connect message.

.

CustomConnectMessagePrefixPhoton ignores the configured string if it sent as a prefix of a client's connect message.

.

CustomConnectMessageSuffixPhoton ignores the configured string if it sent as a suffix of a client's connect message.

.

.

UDPListeners

.

To define a list of UDP/Enet listeners.

.

.

UDPListener

.

SettingPhoton DefaultConfig DefaultDescription

.

IPAddress0.0.0.0The IP Address to listen on, e.g. 192.168.0.1 or 0.0.0.0 to listen on ALL interfaces.

.

Port50555055The port to listen on.

.

ListenBacklog500See TCPListener.

.

RecvBufferSizeSee TCPListener.

.

SendBufferSizeSee TCPListener.

.

OverrideApplicationSee TCPListener.

.

DefaultApplicationSee TCPListener.

.

MaxInboundMessageSizeSee TCPListener.

.

MaxOutboundMessageSizeSee TCPListener.

.

.

WebSocketListeners

.

WebSocketListener

.

SettingPhoton DefaultConfig DefaultDescription

.

IPAddress0.0.0.0The IP Address to listen on, e.g. 192.168.0.1 or 0.0.0.0 to listen on ALL interfaces.

.

Port5051The port to listen on.

.

ListenBacklogSee TCPListener.

.

RecvBufferSizeSee TCPListener.

.

SendBufferSizeSee TCPListener.

.

DisableNagleTRUETRUESee TCPListener.

.

InactivityTimeout1000010000See TCPListener.

.

OverrideApplicationSee TCPListener.

.

DefaultApplicationSee TCPListener.

.

MaxInboundMessageSizeSee TCPListener.

.

MaxOutboundMessageSizeSee TCPListener.

.

MaxPendingWritesSee TCPListener.

.

MaxQueuedBuffersSee TCPListener.

.

DisconnectTimeoutSee TCPListener.

.

.

SSL

.

SettingPhoton DefaultConfig DefaultDescription

.

SecureFALSETrue defines a listener is secured by ssl.

.

StoreNameMYName of store where certificate can be found.

.

CertificateNamePhotonName of certificate to be used.

.

UseMachineStoreFALSEDefines if Machinestore should be used.

.

.

TCPFlashListeners

.

TCPFlashListener

.

Deprecated, use TCPPolicyListener instead.

.

.

TCPPolicyListeners

.

TCPPolicyListener

.

SettingPhoton DefaultConfig DefaultDescription

.

AddressThe IP Address to listen on, e.g. 192.168.0.1 or 0.0.0.0 to listen on ALL interfaces.

.

Port943The port to listen on.

.

ApplicationDefines the application for a Listener.

.

ListenBacklogSee TCPListener.

.

InactivityTimeout1000See TCPListener.

.

.

ConfigServer

.

If a <ConfigServer> node is present then you can configure a listener which presents a text menu based interface to telnet clients. The menu lets you stop, start and restart apps and also allows you to shut the server down.

.

.

SettingPhoton DefaultConfig DefaultDescription

.

IPAddressThe IP Address to listen on, e.g. 192.168.0.1 or 0.0.0.0 to listen on ALL interfaces.

.

Port5051The port to listen on.

.

ListenBacklogSee TCPListener.

.

.

S2S

.

SettingPhoton DefaultConfig DefaultDescription

.

PingFrequency2500The Ping frequency is how often a ping is sent out when no data is flowing.

.

MaxInboundMessageSizeSee TCPListener.

.

MaxOutboundMessageSizeSee TCPListener.

.

RecvBufferSizeSee TCPListener.

.

SendBufferSizeSee TCPListener.

.

MaxPendingWritesSee TCPListener.

.

MaxQueuedBuffersSee TCPListener.

.

MaxPendingWritesMUXsame as MaxQueuedBuffers, but for MUX connections. Only applies if TuneFlowControlForMUX is not set.

.

MaxQueuedBuffersMUXsame as MaxQueuedBuffers, but for MUX connections. Only applies if TuneFlowControlForMUX is not set.

.

TuneFlowControlForMUXMUX connections are configured with X * MaxPendingWrites and X * MaxQueuedBuffers

.

DisableNagleTRUESee TCPListener.

.

.

OutboundENet

.

SettingPhoton DefaultConfig DefaultDescription

.

GenerateOutboundCRC FALSEIf enabled, a 32bit CRC value is appended to each UDP header.

.

MaxInboundMessageSizeSee TCPListener.

.

MaxOutboundMessageSizeSee TCPListener.

.

MTU1200Maximum transmition unit at UDP level. Defaults 1200 - same default the client sdk's have.

.

MaxChannels255Maximum number of Channles the peer should support. Default is 255.

To Document Top