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

[Workloads] Improve logic for getting games to close in matchmaking workload #38

Open
dtest opened this issue Nov 15, 2022 · 0 comments
Milestone

Comments

@dtest
Copy link
Collaborator

dtest commented Nov 15, 2022

The query to get a random open game to be closed looks something like this:

query := fmt.Sprintf("SELECT gameUUID FROM (SELECT gameUUID FROM games WHERE finished IS NULL ORDER BY created DESC LIMIT 10) TABLESAMPLE RESERVOIR (%d ROWS)", 1)

These random queries are too expensive in terms of CPU, especially as the games table grows. Additionally, this is called very frequently.

It would be better to improve the generator logic to get a list of 100-1000 open games to store in a queue. When the queue is empty, another call to get more games to close is issued to the backend.

@dtest dtest added this to the v0.2.0 milestone Nov 15, 2022
@dtest dtest modified the milestones: v0.2.0 , v0.1.4 May 8, 2023
@dtest dtest changed the title [Generator] Improve logic for getting games to close [workloads] Improve logic for getting games to close in matchmaking workload May 8, 2023
@dtest dtest changed the title [workloads] Improve logic for getting games to close in matchmaking workload [Workloads] Improve logic for getting games to close in matchmaking workload May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant