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

⚡ Performance improvements for /api/Leaderboard/Get #1147

Merged
merged 5 commits into from
Jan 17, 2025

Conversation

jernejk
Copy link
Member

@jernejk jernejk commented Jan 17, 2025

  1. What triggered this change? (PBI link, Email Subject, conversation + reason, etc)

✏️ #1119
This endpoint is called very frequently and can be very slow.

  1. What was changed?

✏️ Rewrite query to be about 2x faster on my local machine.

When using 10 threads for 60 seconds it went from 6.8 req/sec to 15.5 req/sec. That's about 2.8 times faster under load.

Based on SQL Server execution plan analysis.

Query Memory grant Memory Used Estimated CPU Cost CPU time
Old 283 MB 8.5MB 0.954 108 ms
New 9.2 MB 9 MB 0.15 48 ms

Also, fixed some incorrect calculations like balance.

Benchmark test:

bombardier -c 10 -d 60s -m GET `
-H "Authorization: Bearer {{ TOKEN }}" `
https://localhost:5001/api/Leaderboard/Get
  1. Did you do pair or mob programming?

✏️ No.

@jernejk jernejk requested a review from vladislav-kir January 17, 2025 09:00
Copy link
Member

@vladislav-kir vladislav-kir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@vladislav-kir vladislav-kir merged commit 9054b76 into main Jan 17, 2025
6 checks passed
@vladislav-kir vladislav-kir deleted the 1119-perf-leaderboard-get branch January 17, 2025 09:02
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.

2 participants