googleforgames / googleforgames/open-match
WatchAssignments efficiency
- Dominant language
- Go
- Stars
- 3.4k
- Forks
- 359
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
The FrontendService method WatchAssignments polls the database waiting for the assignment object to change. The backoff.Retry is set to have a ConstantBackOff (a backoff policy that always returns the same backoff delay). The ConstantBackOff is configured to have backoff.initialInterval delay between reads which defaults to 100ms.
**Describe the solution you'd like**
Rather than polling the database, potentially hundreds of times between submitting a ticket and getting an assignment, WatchAssignments could subscribe to PubSub events related to the ticket id in question and the director could publish once an assignment has been made.
**Describe alternatives you've considered**
None, but happy to discuss other solutions to not polling the database.
**Additional context**
One of the issues highlighted by load testing has been that Redis has been a bottleneck, this will not be helping.
Contributor guide
Research direction
Start with the FrontendService WatchAssignments method and trace its backoff.Retry and ConstantBackOff database polling. Then inspect the PubSub event flow and how the director publishes assignment events for a ticket. Done means WatchAssignments receives the relevant assignment event without repeated database reads, with the behavior validated against the load concerns described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, redis
- Domain
- backend, databases, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100