server | v3 switch to v4  

Performance Tips

Performance is a vital part for providing a fluid and seamless integration of multiplayer components into your application. So we assembled a list of tips you should keep in mind when developing with Photon.

Call Service Regularly

The client libraries rely on regular calls to LitePeer.Service, to keep in touch with the server. Bigger pauses between the service calls could lead to a timeout disconnect, as the client can't keep up the connection.

Loading data is a common situation where less updates per second are done in the main loop. Make sure that service is called despite loading or the connection might suffer and be closed. If overlooked, this problem is hard to identify and reproduce.

Back To Top

Updates Vs. Traffic

Ramping up the number of updates per second makes a game more fluid and up-to-date. On the other hand, traffic might increase dramatically. Keep in mind that possibly each operation you call will create events for other players.

On a mobile client 4 to 6 operations per second are fine. In some cases even 3G devices use pretty slow networking implementations. In fact, it might be faster to send fewer updates per second.

PC based clients can go a lot higher. The target frame rate should be the limit for these clients.

Back To Top

Producing And Consuming Data

Related to the "traffic" topic is the problem of producing only the amount of data that can be consumed on the receiving end. If performance or frame rate don't keep up with incoming events, they are outdated before they are executed.

In the worst case one side produces so much data that it breaks the receiving end. Keep an eye on the queue length of your clients while developing.

Back To Top

Datagram Size

The content size of datagrams is limited to 1200bytes to run on all devices.

Operations and events that are bigger than 1200bytes get fragmented and are sent in multiple commands. These become reliable automatically, so the receiving side can reassemble and dispatch those bigger data chunks when completed.

Bigger data "streams" can considerably affect latency as they need to be reassembled from many packages before they are dispatched. They can be sent in a separate channel, so they don't affect the "throw away" position updates of a (lower) channel number.

기술문서 TOP으로 돌아가기