fix(statuspages): encode a page once for all servers, gzipped
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 11m55s
ci / test (pull_request) Successful in 13m30s
ci / build (pull_request) Successful in 19m20s
ci / image (pull_request) Successful in 5m37s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 11m55s
ci / test (pull_request) Successful in 13m30s
ci / build (pull_request) Successful in 19m20s
ci / image (pull_request) Successful in 5m37s
Every status page server asking for a page got it encoded anew: the snapshot was marshalled once for its checksum and again for the answer, then copied into a stream frame. A page of several thousand components is about 20 MB of JSON, so servers fetching it together, as they do when told it changed, ran both API pods out of their 512 MiB. The shared build now also encodes the page once, as JSON and gzipped, and every server asking at the same time gets those bytes. Servers ask for gzip and unpack it, over HTTP and the stream; older ones still get plain JSON. A 20 MB page shrinks to about 1 MB. Uptime ratios in the snapshot are rounded to six decimals instead of up to 18 characters, never to 100% for a component that failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
3bc927a5f7
commit
9424824416
6 files changed
+182
-22
No files matched your search
@@ -0,0 +1,19 @@
|
||||
package api
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestRoundRatio(t *testing.T) {
|
||||
for _, c := range []struct{ in, want float64 }{
|
||||
{1, 1},
|
||||
{-1, -1},
|
||||
{0, 0},
|
||||
{0.99930555555556, 0.999306},
|
||||
{0.99, 0.99},
|
||||
// One failure in millions still is not 100%.
|
||||
{0.9999997, 0.999999},
|
||||
} {
|
||||
if got := roundRatio(c.in); got != c.want {
|
||||
t.Errorf("roundRatio(%v) = %v, want %v", c.in, got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user