- Notifications
You must be signed in to change notification settings - Fork1k
Commit0ec9df3
authored
fix: reduce impact of GetPrebuildMetrics on database (#19694)
seecoder/internal#959 but the tl; dr is:- we call this DB query on an interval (every 15s) and it would becalled on each coderd replica as well- the generated values update very infrequently (for our most usedinternal template I saw the builds created/claimed update twice in a 1hperiod)- we have no index on the initiator ID, so this query has to scan theentire workspace_builds table on every requestIn reality this should likely just be a Prometheus metric, andPrometheus can handle the counter reset behaviour at query time, but fornow this should at least cut the load of the query to 25% of it'scurrent impact.---------Signed-off-by: Callum Styan <callumstyan@gmail.com>1 parent2030907 commit0ec9df3
File tree
4 files changed
+11
-1
lines changed- coderd/database
- migrations
- enterprise/coderd/prebuilds
4 files changed
+11
-1
lines changedSome generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + |
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + |
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
105 | 105 |
| |
106 | 106 |
| |
107 | 107 |
| |
108 |
| - | |
| 108 | + | |
109 | 109 |
| |
110 | 110 |
| |
111 | 111 |
| |
|
0 commit comments
Comments
(0)