Skip to content

Filter games on the profile page #283

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

Merged
merged 5 commits into from
May 6, 2025
Merged

Conversation

marein
Copy link
Owner

@marein marein commented May 2, 2025

This continues to use Redis for secondary indexing. A ZSET is maintained for each player and game state (all, running, won, lost, drawn), scored by insertion time. An index with 100,000 games takes around 12 MB via MEMORY USAGE.

Advanced lookups, such as games against a specific player, could be implemented by ZINTERSTORE the two most selective sets (e.g. player-1:won and player-2:lost, player-1:drawn player-2:drawn) into a short-lived key, then calling ZCARD and ZREVRANGE.

Because this is using way more sorted set commands, the performance was tested with the /deploy/load-test deployment. 30k req/s over >10 minutes. No hiccups. The StoredEventListener had a parallelism of 1 for each shard. Replaying the whole event stream of a single shard, after having >10 minutes of constant play in the table, took around ~1 1/2 minutes (>10k ZSET and 4k ZREM executions per second). Although this can be speeded up by grouping more Redis commands within a pipeline, or using another indexing technique, e.g. RediSearch, this is fast enough.

@marein marein self-assigned this May 2, 2025
@marein marein linked an issue May 2, 2025 that may be closed by this pull request
@marein marein force-pushed the 4-filter-games-on-the-profile-page branch from 2c17b6f to c46adb4 Compare May 3, 2025 22:56
@marein marein merged commit 86a2dc7 into master May 6, 2025
1 check passed
@marein marein deleted the 4-filter-games-on-the-profile-page branch May 6, 2025 15:27
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

Successfully merging this pull request may close these issues.

Filter games on the profile page
1 participant