Photon Realtime and CCU Billing: Connection Lifecycle Timing
0 reputation · 22 Jul 2024, 22:37 UTC
0 reputation · 22 Jul 2024, 22:37 UTC
Photon Realtime employs a Concurrent User (CCU) licensing model where costs are tied to peak simultaneous connections. In low-traffic environments, maintaining an accurate CCU count is critical to staying within the limits of the Free or low-tier subscriptions and avoiding connection rejections.
There is a technical distinction between a graceful shutdown and an abnormal client disconnection (such as a crash or network timeout). While graceful exits notify the server immediately, abnormal disconnects rely on server-side timeout mechanisms to reclaim the CCU slot.
Given the peak-based billing structure, the latency between a client's actual loss of connectivity and the server's decrementing of the CCU count can impact capacity availability for new users.
28775 reputation · 23 Jul 2024, 09:29 UTC
There is no single fixed timeout you can rely on, and the server-side disconnect timeout in Photon Realtime is not a value you configure yourself on the hosted Photon Cloud. The key facts:
Disconnect()) frees the slot almost immediately. An abnormal disconnect (crash, killed app, network loss) keeps counting until the server's timeout/keepalive mechanism notices the dead connection — typically on the order of tens of seconds, but the exact duration is version- and configuration-dependent and set by Exit Games, not by you.The timeout window only becomes a billing problem when it overlaps with your peak. Three situations commonly cause that:
Since you cannot tune the server-side timeout on Photon Cloud, work on the client lifecycle instead:
Disconnect() explicitly when a player leaves gameplay for a long period (long menus, backgrounded app) and reconnect when needed.Note that room-level settings like PlayerTTL and empty-room TTL govern how long an actor or room persists for rejoin purposes — related, but distinct from CCU counting at the connection level.
Don't trust assumptions about the timeout length — measure it:
Because Exit Games can change counting rules, timeout behavior, and tier limits, confirm the specifics for your plan against the current Photon documentation or with their support before making capacity decisions based on a particular timeout number.
Use comments to ask for clarification. Post a solution as an answer.
28,775 reputation · 23 Jul 2024, 00:09 UTC
To build on the point regarding reconnect storms, it is important to distinguish between a session-level reconnect and a connection-level restart. In Photon Realtime, if a client loses its socket but the server has not yet timed out the previous connection, a new connection attempt may result in a temporary CCU double-count.
To mitigate this without server-side configuration, consider these client-side patterns:
OnDisconnected callback. Implementing a staggered retry timer reduces the likelihood of multiple concurrent connection attempts from a single unstable client.Connect() call to prevent overlapping requests.Verification of this behavior can be done by monitoring the Photon Dashboard's real-time CCU graph while simulating network instability (e.g., using a packet loss simulator) to see if the CCU count spikes higher than the actual number of active users.