Commit c64c10b
fix(datasource): dedupe the pylon saturation warning (EXT-13)
The warning fired once per request let through past max_wait, and the
condition it reports is a saturation that lasts, so it put a line on
every request it described: 1080 lines for a stream 5x over a 120/min
budget for two minutes, burying the first one, which is the only one the
operator needed. It now says its piece once per endpoint per window, and
says so in the line itself, so one line does not read as one request.
A stream 25x over budget for five minutes goes from 15000 lines to 5.
RateLimiter keeps its bookings ordered by inserting into place rather
than appending and sorting. The list is sorted, so the expired bookings
are its leading run and the new one has a single position: pruning is a
prefix drop and the insert is a binary search, where the sort was
O(n log n) per request held under the mutex every endpoint shares. With
20000 bookings in the window an acquire costs 1.9us rather than 620us.
Verified behaviour-preserving against the previous scheduler over 50
randomised trials of limit, window and max_wait: identical sleeps, and
the bookings sorted at every step.
DEFAULT_MAX_WAIT said the region it smooths is "a stream a few percent
over budget", which is optimistic. The waits accumulate rather than
settling, so the bound is crossed sooner the further over budget the
stream sits, and a bypass books inside the window and brings the next
one closer. Measured against a 120/min endpoint: 1% over throttles its
first thousand requests then lets one in twelve through, 5% over gives
up after two hundred and lets half through, and past 10% over the bound
is crossed as the window fills and almost nothing is throttled. The
comment now says that.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent f00f9fc commit c64c10b
2 files changed
Lines changed: 84 additions & 18 deletions
File tree
- packages/forest_admin_datasource_pylon
- lib/forest_admin_datasource_pylon
- spec/forest_admin_datasource_pylon
Lines changed: 42 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
| |||
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
| 53 | + | |
47 | 54 | | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
52 | 59 | | |
53 | | - | |
54 | | - | |
| 60 | + | |
55 | 61 | | |
56 | | - | |
| 62 | + | |
| 63 | + | |
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
| |||
67 | 74 | | |
68 | 75 | | |
69 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
70 | 80 | | |
71 | 81 | | |
72 | 82 | | |
73 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
74 | 86 | | |
75 | 87 | | |
76 | 88 | | |
77 | 89 | | |
78 | 90 | | |
79 | 91 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
86 | 108 | | |
87 | | - | |
| 109 | + | |
| 110 | + | |
88 | 111 | | |
89 | 112 | | |
90 | 113 | | |
91 | 114 | | |
92 | 115 | | |
93 | 116 | | |
94 | | - | |
| 117 | + | |
| 118 | + | |
95 | 119 | | |
96 | 120 | | |
97 | 121 | | |
| |||
Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
91 | 122 | | |
92 | 123 | | |
93 | 124 | | |
| |||
143 | 174 | | |
144 | 175 | | |
145 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
146 | 188 | | |
147 | 189 | | |
148 | 190 | | |
| |||
0 commit comments