Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add player queueing #12

Open
dtest opened this issue Oct 10, 2022 · 1 comment
Open

[Feature Request] Add player queueing #12

dtest opened this issue Oct 10, 2022 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@dtest
Copy link
Collaborator

dtest commented Oct 10, 2022

Due to the way matchmaking currently works, there is a bottleneck on scaling matchmaking and player signups:

  • If we have more than 1 createGame attempt at a time, we run into deadlocks as matchmaking tries to assign the same players to different games.
  • Due to locking for these deadlocks on the 'PlayerGame' index, actually inserting new players (CreatePlayer) suffers higher write latency.

To mitigate this, instead of assigning players to a game from ALL players ever, introduce a queue that simulates players 'getting ready to play'. This should reduce/remove lock contention on the PlayerGame index. We may still get deadlocks for concurrent CreateGame attempts, but it should be much smaller chance.

Design:

  • modify schema to allow for queue
  • modify matchmaking to assign players longest in the queue
  • keep track of average wait time in queue
  • game cannot be created if not enough players are in the queue.
  • game should not be created if players wait < average wait time. If there's not an average wait time, set a floor to prevent a flood of game creations.
@dtest dtest changed the title Add player queueing [Feature Request] Add player queueing Oct 11, 2022
@dtest dtest added the enhancement New feature or request label Oct 11, 2022
@dtest dtest added this to the v0.2.0 milestone Oct 11, 2022
@dtest
Copy link
Collaborator Author

dtest commented Oct 24, 2022

For the queuing aspect, we could use a 'login' column with some additional player endpoints #37

A player can be added to a game if current_game IS NULL AND logged_in IS NOT NULL

@dtest dtest removed this from the v0.2.0 milestone Nov 15, 2022
@dtest dtest added this to the 0.3.0 milestone Feb 22, 2023
@dtest dtest modified the milestones: v0.3.0, v0.2.0 May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant