Durch die Nutzung von AWS re:Post stimmt du den AWS re:Post Nutzungsbedingungen

Does Gamelift always provide a unique ip, port pair for game session?

0

Hi, I use gamelift with my logic for creating game session. In my logic, send game session command first and get ip, port pair. And second, find previous fleet instance by ip-port pair in my DB. If there is no one, i save ip-port fair for prevent another session use that ip-port.

The reason I ask this question is because I often get duplicate values(i mean ip-port pair). Does Gamelift provide a unique ip, port pair for game session? If not, what happens to previous create game session commands? Just ignored?

gefragt vor 2 Monaten91 Aufrufe
1 Antwort
0
Akzeptierte Antwort

The way GameLift handles game session creation and the associated IP/port pairs is an important consideration.

Unique IP/Port Pairs: GameLift does not guarantee that every created game session will have a unique IP/port pair. This is because the IP/port pair is primarily determined by the underlying infrastructure and networking configurations, not directly by GameLift.

Previous Game Session Commands: When you create a new game session, GameLift will attempt to allocate a new IP/port pair for that session. However, if the previous game session is still active and holding onto the same IP/port, GameLift will reuse that same IP/port pair for the new game session.

Ignored Previous Commands: If the previous game session has already been terminated, but the IP/port pair is still in the process of being released back into the pool of available addresses, GameLift may still reuse that same IP/port for the new game session. In this case, the previous game session creation command would effectively be ignored.

To address the issue of duplicate IP/port pairs in your database, here are a few recommendations:

Implement Expiration Checks: When looking up the IP/port pair in your database, also check the last time the game session was active. If it's been a significant amount of time (e.g., a few minutes) since the session was active, you can assume the IP/port pair is now available and allow the new session to use it.

Use GameLift Session Metadata: GameLift provides session metadata that includes a unique session ID. You can store this session ID along with the IP/port pair in your database, and use the session ID as the primary identifier instead of just the IP/port pair.

Implement Retries: If you encounter a duplicate IP/port pair, you can try retrying the game session creation a few times. GameLift may be able to allocate a new IP/port pair on a subsequent attempt.

Consider Using a Queue-based Approach: Instead of immediately creating the game session, you can add the request to a queue and let GameLift manage the session creation. This can help you avoid the potential race conditions and duplicate IP/port pairs.

By understanding the underlying behavior of GameLift's IP/port pair allocation and implementing strategies to handle potential duplicates, you can improve the reliability and consistency of your game session management.

beantwortet vor 2 Monaten
  • Thank you for your answer! But can i ask one more question? If i use queue-based approach, gamelift guarantee unique ip/port pair?

  • I think I wrote the question wrong, so I'll add it. What I wanted to know is whether the ip/port pair returned by GameLift is available immediately and not from a session already in use.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen