---
# System prepended metadata

title: Load Balancer

---

The Load Balancer is a key component that plays a crucial role in optimizing the performance and user experience of game applications. It is designed to efficiently distribute user connections across multiple game servers, ensuring that each client connects to the server with the lowest latency and load.

The Load Balancer is responsible for controlling the flow of user traffic, strategically routing incoming connections to the most appropriate game server based on various factors such as server latency, current load, and other relevant parameters. By evenly distributing the workload among different servers, the Load Balancer helps prevent overloading of individual servers and ensures smooth gameplay experiences for all players.

Within the Game Carrier framework, the Load Balancer service is composed of three integral components:

1. **Authentication Server** handles the authentication of clients, session management, and token generation. It enables clients to authenticate with the server, create sessions, generate authentication tokens, renew tokens, and sign out of sessions. Additionally, it provides seamless integration with various authentication systems used by popular platforms such as Steam, Playstation, Xbox, Nintendo Switch, Epic Games Store, Xsolla, Android, and iOS.

2. **Jump Server** acts as an intermediary between the Client Application and the Game Server, the Jump Server intelligently routes users to the most suitable game server. It takes into account factors like server latency, current server load, and other relevant parameters to ensure an optimized connection for each client. By efficiently distributing users, the Jump Server helps balance the load across different game servers and prevents bottlenecks.

3. **Game Server** allows running the game application where players connect to participate in gameplay. It provides the necessary infrastructure and resources to handle game-related operations, including real-time communication, game logic execution, and data management.

By combining these components, the Load Balancer in Game Carrier offers a comprehensive solution for optimizing the distribution of user connections, minimizing latency, and ensuring a scalable and responsive gaming experience. It allows game developers to focus on creating engaging gameplay while relying on the Load Balancer to handle the efficient management of player connections.

## Load Balancer Mechanism

The diagram presented below depicts the interaction between the client application and the Load Balancer.

To begin, the client application initiates a connection with the Authentication Server in order to obtain a user token. Upon successful retrieval of the token, the Authentication Server also furnishes the client application with a list of Jump Servers. The client selects one Jump Server from the list with the smallest latency and establishes a new connection.



![Load Balancer 1](https://hackmd.io/_uploads/B17R3tZFh.png)


The Jump Server, in turn, actively communicates with available Game Servers to gather performance and network statistics. This information is utilized to intelligently distribute user traffic, ensuring that each client connects to the most suitable Game Server with the least amount of load.

Upon successful connection to the Jump Server, the Client Application receives the IP address and port information of the Game Server hosting the desired game.

![Load Balancer 2](https://hackmd.io/_uploads/SJJepYWtn.png)


With the Game Server address in hand, the Client Application proceeds to establish a new session and directly communicates with the Game Server.

![Load Balancer 3](https://hackmd.io/_uploads/HJolTtZth.png)
