@drupflare/spool 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1749 -2
- package/dist/cdn/client.js +1 -0
- package/dist/cdn/location.d.ts +11 -0
- package/dist/cdn/location.js +15 -0
- package/dist/cdn/manifest.json +16 -0
- package/dist/cdn/spool-sw.js +1 -0
- package/dist/client/entry.d.ts +1 -0
- package/dist/client/entry.js +25 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +2 -0
- package/dist/client/lifecycle.d.ts +10 -0
- package/dist/client/lifecycle.js +10 -0
- package/dist/client/loads.d.ts +16 -0
- package/dist/client/loads.js +41 -0
- package/dist/client/register.d.ts +34 -0
- package/dist/client/register.js +58 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/media/embeds.d.ts +59 -0
- package/dist/media/embeds.js +120 -0
- package/dist/media/headers.d.ts +13 -0
- package/dist/media/headers.js +44 -0
- package/dist/media/html.d.ts +27 -0
- package/dist/media/html.js +93 -0
- package/dist/media/image.d.ts +222 -0
- package/dist/media/image.js +413 -0
- package/dist/media/index.d.ts +6 -0
- package/dist/media/index.js +6 -0
- package/dist/media/lazy.d.ts +26 -0
- package/dist/media/lazy.js +74 -0
- package/dist/media/responsive.d.ts +45 -0
- package/dist/media/responsive.js +98 -0
- package/dist/media/video.d.ts +30 -0
- package/dist/media/video.js +75 -0
- package/dist/node/listener.d.ts +19 -0
- package/dist/node/listener.js +76 -0
- package/dist/protocol/artifact.d.ts +54 -0
- package/dist/protocol/artifact.js +79 -0
- package/dist/protocol/assembly.d.ts +34 -0
- package/dist/protocol/assembly.js +72 -0
- package/dist/protocol/beacon.d.ts +59 -0
- package/dist/protocol/beacon.js +86 -0
- package/dist/protocol/collector.d.ts +41 -0
- package/dist/protocol/collector.js +84 -0
- package/dist/protocol/config.d.ts +89 -0
- package/dist/protocol/config.js +13 -0
- package/dist/protocol/envelope.d.ts +47 -0
- package/dist/protocol/envelope.js +162 -0
- package/dist/protocol/errors.d.ts +7 -0
- package/dist/protocol/errors.js +9 -0
- package/dist/protocol/graph.d.ts +81 -0
- package/dist/protocol/graph.js +201 -0
- package/dist/protocol/index.d.ts +19 -0
- package/dist/protocol/index.js +19 -0
- package/dist/protocol/manifest.d.ts +29 -0
- package/dist/protocol/manifest.js +94 -0
- package/dist/protocol/normalise.d.ts +20 -0
- package/dist/protocol/normalise.js +29 -0
- package/dist/protocol/pattern.d.ts +12 -0
- package/dist/protocol/pattern.js +82 -0
- package/dist/protocol/provision.d.ts +100 -0
- package/dist/protocol/provision.js +105 -0
- package/dist/protocol/route.d.ts +179 -0
- package/dist/protocol/route.js +135 -0
- package/dist/protocol/sync.d.ts +31 -0
- package/dist/protocol/sync.js +87 -0
- package/dist/protocol/tag.d.ts +12 -0
- package/dist/protocol/tag.js +26 -0
- package/dist/protocol/template/compile.d.ts +35 -0
- package/dist/protocol/template/compile.js +82 -0
- package/dist/protocol/template/interpret.d.ts +9 -0
- package/dist/protocol/template/interpret.js +82 -0
- package/dist/protocol/vector.d.ts +32 -0
- package/dist/protocol/vector.js +56 -0
- package/dist/protocol/view.d.ts +110 -0
- package/dist/protocol/view.js +201 -0
- package/dist/proxy/dictionary.d.ts +58 -0
- package/dist/proxy/dictionary.js +197 -0
- package/dist/proxy/eligible.d.ts +45 -0
- package/dist/proxy/eligible.js +96 -0
- package/dist/proxy/index.d.ts +5 -0
- package/dist/proxy/index.js +5 -0
- package/dist/proxy/proxy.d.ts +133 -0
- package/dist/proxy/proxy.js +507 -0
- package/dist/proxy/purge.d.ts +10 -0
- package/dist/proxy/purge.js +66 -0
- package/dist/proxy/tags.d.ts +8 -0
- package/dist/proxy/tags.js +36 -0
- package/dist/report/derive.d.ts +223 -0
- package/dist/report/derive.js +494 -0
- package/dist/report/economics.d.ts +14 -0
- package/dist/report/economics.js +24 -0
- package/dist/report/index.d.ts +9 -0
- package/dist/report/index.js +9 -0
- package/dist/report/inputs.d.ts +141 -0
- package/dist/report/inputs.js +216 -0
- package/dist/report/ledger.d.ts +169 -0
- package/dist/report/ledger.js +278 -0
- package/dist/report/measurement.d.ts +48 -0
- package/dist/report/measurement.js +117 -0
- package/dist/report/model.d.ts +42 -0
- package/dist/report/model.js +74 -0
- package/dist/report/thirdparty.d.ts +62 -0
- package/dist/report/thirdparty.js +107 -0
- package/dist/report/traffic.d.ts +140 -0
- package/dist/report/traffic.js +228 -0
- package/dist/report/trim.d.ts +81 -0
- package/dist/report/trim.js +105 -0
- package/dist/server/beacon.d.ts +20 -0
- package/dist/server/beacon.js +47 -0
- package/dist/server/embedded.d.ts +6 -0
- package/dist/server/embedded.js +6 -0
- package/dist/server/ga4.d.ts +70 -0
- package/dist/server/ga4.js +165 -0
- package/dist/server/identity.d.ts +12 -0
- package/dist/server/identity.js +17 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +7 -0
- package/dist/server/sink.d.ts +56 -0
- package/dist/server/sink.js +133 -0
- package/dist/server/size.d.ts +7 -0
- package/dist/server/size.js +18 -0
- package/dist/server/spool.d.ts +97 -0
- package/dist/server/spool.js +463 -0
- package/dist/server/stub.d.ts +9 -0
- package/dist/server/stub.js +19 -0
- package/dist/server/sync.d.ts +12 -0
- package/dist/server/sync.js +48 -0
- package/dist/server/work.d.ts +22 -0
- package/dist/server/work.js +30 -0
- package/dist/stores/durable-object.d.ts +19 -0
- package/dist/stores/durable-object.js +53 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/index.js +2 -0
- package/dist/stores/memory.d.ts +4 -0
- package/dist/stores/memory.js +10 -0
- package/dist/stores/version-store.d.ts +11 -0
- package/dist/stores/version-store.js +1 -0
- package/dist/sw/analytics.d.ts +81 -0
- package/dist/sw/analytics.js +275 -0
- package/dist/sw/collect.d.ts +8 -0
- package/dist/sw/collect.js +33 -0
- package/dist/sw/core.d.ts +1 -0
- package/dist/sw/core.js +3 -0
- package/dist/sw/freshness.d.ts +15 -0
- package/dist/sw/freshness.js +20 -0
- package/dist/sw/graph/index.d.ts +67 -0
- package/dist/sw/graph/index.js +170 -0
- package/dist/sw/graph/invalidate.d.ts +23 -0
- package/dist/sw/graph/invalidate.js +109 -0
- package/dist/sw/graph/projections.d.ts +7 -0
- package/dist/sw/graph/projections.js +9 -0
- package/dist/sw/graph/records.d.ts +7 -0
- package/dist/sw/graph/records.js +9 -0
- package/dist/sw/graph/store.d.ts +32 -0
- package/dist/sw/graph/store.js +52 -0
- package/dist/sw/idb.d.ts +8 -0
- package/dist/sw/idb.js +117 -0
- package/dist/sw/index.d.ts +2 -0
- package/dist/sw/index.js +1 -0
- package/dist/sw/partition.d.ts +21 -0
- package/dist/sw/partition.js +137 -0
- package/dist/sw/policy.d.ts +8 -0
- package/dist/sw/policy.js +24 -0
- package/dist/sw/provision.d.ts +39 -0
- package/dist/sw/provision.js +61 -0
- package/dist/sw/render.d.ts +21 -0
- package/dist/sw/render.js +53 -0
- package/dist/sw/replica.d.ts +77 -0
- package/dist/sw/replica.js +299 -0
- package/dist/sw/router.d.ts +42 -0
- package/dist/sw/router.js +48 -0
- package/dist/sw/routing.d.ts +23 -0
- package/dist/sw/routing.js +48 -0
- package/dist/sw/runtime.d.ts +112 -0
- package/dist/sw/runtime.js +1070 -0
- package/dist/sw/scheduler.d.ts +83 -0
- package/dist/sw/scheduler.js +149 -0
- package/dist/sw/seal.d.ts +37 -0
- package/dist/sw/seal.js +183 -0
- package/dist/sw/serve.d.ts +15 -0
- package/dist/sw/serve.js +63 -0
- package/dist/sw/shadow.d.ts +16 -0
- package/dist/sw/shadow.js +27 -0
- package/dist/sw/static.d.ts +17 -0
- package/dist/sw/static.js +81 -0
- package/dist/sw/storage.d.ts +64 -0
- package/dist/sw/storage.js +34 -0
- package/dist/sw/thirdparty.d.ts +17 -0
- package/dist/sw/thirdparty.js +36 -0
- package/dist/trim/css.d.ts +38 -0
- package/dist/trim/css.js +328 -0
- package/dist/trim/index.d.ts +3 -0
- package/dist/trim/index.js +3 -0
- package/dist/trim/manifest.d.ts +67 -0
- package/dist/trim/manifest.js +134 -0
- package/dist/trim/tokens.d.ts +47 -0
- package/dist/trim/tokens.js +142 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +3 -0
- package/package.json +150 -5
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/** where a figure comes from: L0 published, L1 measured here, L2 derived from L0/L1, L3 scenario */
|
|
2
|
+
export type Layer = 'L0' | 'L1' | 'L2' | 'L3';
|
|
3
|
+
/** one model input, carried with its unit, layer and source so a table can print all three */
|
|
4
|
+
export type Input = {
|
|
5
|
+
value: number;
|
|
6
|
+
unit: string;
|
|
7
|
+
layer: Layer;
|
|
8
|
+
source: string;
|
|
9
|
+
};
|
|
10
|
+
/** Sustainable Web Design v4 operational intensities, the attributional headline's basis */
|
|
11
|
+
export declare const SWD_V4: {
|
|
12
|
+
readonly network: {
|
|
13
|
+
readonly value: 0.059;
|
|
14
|
+
readonly unit: "kWh/GB";
|
|
15
|
+
readonly layer: "L0";
|
|
16
|
+
readonly source: "sustainablewebdesign.org/estimating-digital-emissions (web page read 2026-10-18)";
|
|
17
|
+
};
|
|
18
|
+
readonly datacentre: {
|
|
19
|
+
readonly value: 0.055;
|
|
20
|
+
readonly unit: "kWh/GB";
|
|
21
|
+
readonly layer: "L0";
|
|
22
|
+
readonly source: "sustainablewebdesign.org/estimating-digital-emissions (web page read 2026-10-18)";
|
|
23
|
+
};
|
|
24
|
+
readonly device: {
|
|
25
|
+
readonly value: 0.08;
|
|
26
|
+
readonly unit: "kWh/GB";
|
|
27
|
+
readonly layer: "L0";
|
|
28
|
+
readonly source: "sustainablewebdesign.org/estimating-digital-emissions (web page read 2026-10-18)";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Median bytes of the document request a default local view replaces, on a repeat view of an
|
|
33
|
+
* already-seen home page. Sub-resources are left out: an optimized HTTP cache already keeps static
|
|
34
|
+
* files, and the page's own API calls and third-party requests still leave during a local view.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DOCUMENT_BYTES: Input;
|
|
37
|
+
/** share of higher-ed web sessions on phones */
|
|
38
|
+
export declare const MOBILE_SHARE: Input;
|
|
39
|
+
/**
|
|
40
|
+
* Radio wake avoided per zero-network view on a phone. The headline uses `attributed`, which stays 0
|
|
41
|
+
* until a phone reading attributes a wake to a network view; the others are sensitivity values.
|
|
42
|
+
*/
|
|
43
|
+
export declare const RADIO_J: {
|
|
44
|
+
readonly attributed: {
|
|
45
|
+
readonly value: 0;
|
|
46
|
+
readonly unit: "J";
|
|
47
|
+
readonly layer: "L1";
|
|
48
|
+
readonly source: "measurements/iphone/2026-10-19-{paced,radio}-cellular.json: no wake attributable to a network view or an isolated request";
|
|
49
|
+
};
|
|
50
|
+
readonly low: {
|
|
51
|
+
readonly value: 2;
|
|
52
|
+
readonly unit: "J";
|
|
53
|
+
readonly layer: "L3";
|
|
54
|
+
readonly source: "scenario";
|
|
55
|
+
};
|
|
56
|
+
readonly central: {
|
|
57
|
+
readonly value: 5;
|
|
58
|
+
readonly unit: "J";
|
|
59
|
+
readonly layer: "L3";
|
|
60
|
+
readonly source: "scenario";
|
|
61
|
+
};
|
|
62
|
+
readonly high: {
|
|
63
|
+
readonly value: 12;
|
|
64
|
+
readonly unit: "J";
|
|
65
|
+
readonly layer: "L0";
|
|
66
|
+
readonly source: "Thiagarajan et al. WWW 2012, 3G setup cost (full text)";
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
/** origin energy per avoided request */
|
|
70
|
+
export declare const ORIGIN_J: {
|
|
71
|
+
readonly conventional: {
|
|
72
|
+
readonly value: 0.455;
|
|
73
|
+
readonly unit: "J";
|
|
74
|
+
readonly layer: "L1";
|
|
75
|
+
readonly source: "drupflare/worker docs/impact.md, RAPL mix @40 views/s, regular host, idle subtracted";
|
|
76
|
+
};
|
|
77
|
+
readonly drupflare: {
|
|
78
|
+
readonly value: 0.0054;
|
|
79
|
+
readonly unit: "J";
|
|
80
|
+
readonly layer: "L2";
|
|
81
|
+
readonly source: "drupflare/worker docs/impact.md, energy per view at 10M views/month";
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
/** a host at 15% load on the SPECpower curve the worker's impact model uses */
|
|
85
|
+
export declare const SERVER_WATTS: Input;
|
|
86
|
+
/** colocation facility overhead */
|
|
87
|
+
export declare const PUE: Input;
|
|
88
|
+
/** monthly views the Workers free plan carries at one request per view */
|
|
89
|
+
export declare const FREE_TIER_VIEWS: Input;
|
|
90
|
+
/**
|
|
91
|
+
* Share of all views that are a device's first view of a page it has not seen, so they go to the
|
|
92
|
+
* network and move that page's new bytes. A scenario range: the low end is a new-visitor session
|
|
93
|
+
* share times the share of views that are not a session's entry; the high end is a phone study.
|
|
94
|
+
*/
|
|
95
|
+
export declare const FIRST_VIEW_SHARE: {
|
|
96
|
+
readonly low: {
|
|
97
|
+
readonly value: 0.451;
|
|
98
|
+
readonly unit: "fraction";
|
|
99
|
+
readonly layer: "L3";
|
|
100
|
+
readonly source: "spool-survey-breakeven.md Part D: 79.8% new-visitor sessions (Study in the States, one .gov site, October 2021; labelled FT-C in the survey, not re-read here) x (1 - 1/2.3 pages per session, OHO 2023 benchmarks, web page), computed";
|
|
101
|
+
};
|
|
102
|
+
readonly central: {
|
|
103
|
+
readonly value: 0.6;
|
|
104
|
+
readonly unit: "fraction";
|
|
105
|
+
readonly layer: "L3";
|
|
106
|
+
readonly source: "spool-survey-breakeven.md Part D: the midpoint of the low and high values, a choice";
|
|
107
|
+
};
|
|
108
|
+
readonly high: {
|
|
109
|
+
readonly value: 0.75;
|
|
110
|
+
readonly unit: "fraction";
|
|
111
|
+
readonly layer: "L3";
|
|
112
|
+
readonly source: "LiveLab, Wang et al. TR1215-2011 (full text): on average 75% of the webpages 24 iPhone users visited were new visits";
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
/** share of origin load that is reads spool can answer, before a trace replaces it */
|
|
116
|
+
export declare const READ_SHARE: Input;
|
|
117
|
+
/** servers a redundant deployment keeps whatever the load */
|
|
118
|
+
export declare const SERVER_FLOOR: Input;
|
|
119
|
+
/** date the vendor pricing pages below were read */
|
|
120
|
+
export declare const PRICES_READ = "2026-10-19";
|
|
121
|
+
/** a host's published list prices for traffic a local view no longer sends */
|
|
122
|
+
export type HostPrice = {
|
|
123
|
+
name: string;
|
|
124
|
+
/** the tier the egress price is taken from */
|
|
125
|
+
tier: string;
|
|
126
|
+
page: string;
|
|
127
|
+
egress: Input;
|
|
128
|
+
bytesPerUnit: number;
|
|
129
|
+
freeAllowance?: Input;
|
|
130
|
+
requests?: Input;
|
|
131
|
+
};
|
|
132
|
+
/** list prices of hosts higher ed uses, first paid tier, USD, read from each vendor's own page */
|
|
133
|
+
export declare const HOSTS: readonly HostPrice[];
|
|
134
|
+
/** Pantheon bills traffic in unique visits, which no per-view figure converts to */
|
|
135
|
+
export declare const PANTHEON_OVERAGE: Input;
|
|
136
|
+
/** the three tiers, named by the share of annual views served with zero network */
|
|
137
|
+
export declare const TIERS: {
|
|
138
|
+
readonly meaningful: 0.3;
|
|
139
|
+
readonly major: 0.65;
|
|
140
|
+
readonly transformative: 0.9;
|
|
141
|
+
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/** Sustainable Web Design v4 operational intensities, the attributional headline's basis */
|
|
2
|
+
export const SWD_V4 = {
|
|
3
|
+
network: {
|
|
4
|
+
value: 0.059,
|
|
5
|
+
unit: 'kWh/GB',
|
|
6
|
+
layer: 'L0',
|
|
7
|
+
source: 'sustainablewebdesign.org/estimating-digital-emissions (web page read 2026-10-18)'
|
|
8
|
+
},
|
|
9
|
+
datacentre: {
|
|
10
|
+
value: 0.055,
|
|
11
|
+
unit: 'kWh/GB',
|
|
12
|
+
layer: 'L0',
|
|
13
|
+
source: 'sustainablewebdesign.org/estimating-digital-emissions (web page read 2026-10-18)'
|
|
14
|
+
},
|
|
15
|
+
device: {
|
|
16
|
+
value: 0.08,
|
|
17
|
+
unit: 'kWh/GB',
|
|
18
|
+
layer: 'L0',
|
|
19
|
+
source: 'sustainablewebdesign.org/estimating-digital-emissions (web page read 2026-10-18)'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Median bytes of the document request a default local view replaces, on a repeat view of an
|
|
24
|
+
* already-seen home page. Sub-resources are left out: an optimized HTTP cache already keeps static
|
|
25
|
+
* files, and the page's own API calls and third-party requests still leave during a local view.
|
|
26
|
+
*/
|
|
27
|
+
export const DOCUMENT_BYTES = {
|
|
28
|
+
value: 17_054,
|
|
29
|
+
unit: 'B',
|
|
30
|
+
layer: 'L1',
|
|
31
|
+
source: 'median repeat-view document request over every measurements/repeat-nav reading (Playwright + CDP, n=1 per site per reading)'
|
|
32
|
+
};
|
|
33
|
+
/** share of higher-ed web sessions on phones */
|
|
34
|
+
export const MOBILE_SHARE = {
|
|
35
|
+
value: 0.43,
|
|
36
|
+
unit: 'fraction',
|
|
37
|
+
layer: 'L0',
|
|
38
|
+
source: 'OHO, 2023 Google Analytics benchmarks for higher education websites, 2022 data: 43.2% mobile (web page)'
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Radio wake avoided per zero-network view on a phone. The headline uses `attributed`, which stays 0
|
|
42
|
+
* until a phone reading attributes a wake to a network view; the others are sensitivity values.
|
|
43
|
+
*/
|
|
44
|
+
export const RADIO_J = {
|
|
45
|
+
attributed: {
|
|
46
|
+
value: 0,
|
|
47
|
+
unit: 'J',
|
|
48
|
+
layer: 'L1',
|
|
49
|
+
source: 'measurements/iphone/2026-10-19-{paced,radio}-cellular.json: no wake attributable to a network view or an isolated request'
|
|
50
|
+
},
|
|
51
|
+
low: { value: 2, unit: 'J', layer: 'L3', source: 'scenario' },
|
|
52
|
+
central: { value: 5, unit: 'J', layer: 'L3', source: 'scenario' },
|
|
53
|
+
high: {
|
|
54
|
+
value: 12,
|
|
55
|
+
unit: 'J',
|
|
56
|
+
layer: 'L0',
|
|
57
|
+
source: 'Thiagarajan et al. WWW 2012, 3G setup cost (full text)'
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
/** origin energy per avoided request */
|
|
61
|
+
export const ORIGIN_J = {
|
|
62
|
+
conventional: {
|
|
63
|
+
value: 0.455,
|
|
64
|
+
unit: 'J',
|
|
65
|
+
layer: 'L1',
|
|
66
|
+
source: 'drupflare/worker docs/impact.md, RAPL mix @40 views/s, regular host, idle subtracted'
|
|
67
|
+
},
|
|
68
|
+
drupflare: {
|
|
69
|
+
value: 0.0054,
|
|
70
|
+
unit: 'J',
|
|
71
|
+
layer: 'L2',
|
|
72
|
+
source: 'drupflare/worker docs/impact.md, energy per view at 10M views/month'
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
/** a host at 15% load on the SPECpower curve the worker's impact model uses */
|
|
76
|
+
export const SERVER_WATTS = {
|
|
77
|
+
value: 282,
|
|
78
|
+
unit: 'W',
|
|
79
|
+
layer: 'L2',
|
|
80
|
+
source: 'drupflare/worker docs/impact.md, SPECpower Dell R6725 measured curve at 15% load'
|
|
81
|
+
};
|
|
82
|
+
/** colocation facility overhead */
|
|
83
|
+
export const PUE = {
|
|
84
|
+
value: 1.54,
|
|
85
|
+
unit: 'ratio',
|
|
86
|
+
layer: 'L0',
|
|
87
|
+
source: 'Uptime Institute average, as cited in drupflare/worker docs/impact.md'
|
|
88
|
+
};
|
|
89
|
+
/** monthly views the Workers free plan carries at one request per view */
|
|
90
|
+
export const FREE_TIER_VIEWS = {
|
|
91
|
+
value: 3_040_000,
|
|
92
|
+
unit: 'views/month',
|
|
93
|
+
layer: 'L2',
|
|
94
|
+
source: '100,000 Worker requests/day (Cloudflare, L0) x 30.4 days'
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Share of all views that are a device's first view of a page it has not seen, so they go to the
|
|
98
|
+
* network and move that page's new bytes. A scenario range: the low end is a new-visitor session
|
|
99
|
+
* share times the share of views that are not a session's entry; the high end is a phone study.
|
|
100
|
+
*/
|
|
101
|
+
export const FIRST_VIEW_SHARE = {
|
|
102
|
+
low: {
|
|
103
|
+
value: 0.451,
|
|
104
|
+
unit: 'fraction',
|
|
105
|
+
layer: 'L3',
|
|
106
|
+
source: 'spool-survey-breakeven.md Part D: 79.8% new-visitor sessions (Study in the States, one .gov site, October 2021; labelled FT-C in the survey, not re-read here) x (1 - 1/2.3 pages per session, OHO 2023 benchmarks, web page), computed'
|
|
107
|
+
},
|
|
108
|
+
central: {
|
|
109
|
+
value: 0.6,
|
|
110
|
+
unit: 'fraction',
|
|
111
|
+
layer: 'L3',
|
|
112
|
+
source: 'spool-survey-breakeven.md Part D: the midpoint of the low and high values, a choice'
|
|
113
|
+
},
|
|
114
|
+
high: {
|
|
115
|
+
value: 0.75,
|
|
116
|
+
unit: 'fraction',
|
|
117
|
+
layer: 'L3',
|
|
118
|
+
source: 'LiveLab, Wang et al. TR1215-2011 (full text): on average 75% of the webpages 24 iPhone users visited were new visits'
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
/** share of origin load that is reads spool can answer, before a trace replaces it */
|
|
122
|
+
export const READ_SHARE = { value: 0.9, unit: 'fraction', layer: 'L3', source: 'scenario' };
|
|
123
|
+
/** servers a redundant deployment keeps whatever the load */
|
|
124
|
+
export const SERVER_FLOOR = { value: 2, unit: 'servers', layer: 'L3', source: 'scenario' };
|
|
125
|
+
/** date the vendor pricing pages below were read */
|
|
126
|
+
export const PRICES_READ = '2026-10-19';
|
|
127
|
+
/** list prices of hosts higher ed uses, first paid tier, USD, read from each vendor's own page */
|
|
128
|
+
export const HOSTS = [
|
|
129
|
+
{
|
|
130
|
+
name: 'Cloudflare Workers (Standard plan)',
|
|
131
|
+
tier: 'Standard plan, requests past the included 10 million a month',
|
|
132
|
+
page: 'developers.cloudflare.com/workers/platform/pricing',
|
|
133
|
+
egress: {
|
|
134
|
+
value: 0,
|
|
135
|
+
unit: 'USD/GB',
|
|
136
|
+
layer: 'L0',
|
|
137
|
+
source: `developers.cloudflare.com/workers/platform/pricing (web page read ${PRICES_READ}): "no additional charges for data transfer (egress) or throughput (bandwidth)"`
|
|
138
|
+
},
|
|
139
|
+
bytesPerUnit: 1e9,
|
|
140
|
+
requests: {
|
|
141
|
+
value: 0.3,
|
|
142
|
+
unit: 'USD/million requests',
|
|
143
|
+
layer: 'L0',
|
|
144
|
+
source: `developers.cloudflare.com/workers/platform/pricing (web page read ${PRICES_READ}): 10 million included a month, then $0.30 per additional million; static asset requests are free`
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'AWS CloudFront (pay as you go)',
|
|
149
|
+
tier: 'United States, Mexico and Canada; the next 9 TB after the first free 1 TB',
|
|
150
|
+
page: 'aws.amazon.com/cloudfront/pricing/pay-as-you-go',
|
|
151
|
+
egress: {
|
|
152
|
+
value: 0.085,
|
|
153
|
+
unit: 'USD/GB',
|
|
154
|
+
layer: 'L0',
|
|
155
|
+
source: `aws.amazon.com/cloudfront/pricing/pay-as-you-go (web page read ${PRICES_READ}): data transfer out to internet, $0.085 per GB for the next 9 TB`
|
|
156
|
+
},
|
|
157
|
+
bytesPerUnit: 1e9,
|
|
158
|
+
freeAllowance: {
|
|
159
|
+
value: 1000,
|
|
160
|
+
unit: 'GB/month',
|
|
161
|
+
layer: 'L0',
|
|
162
|
+
source: `aws.amazon.com/cloudfront/pricing/pay-as-you-go (web page read ${PRICES_READ}): first 1 TB free`
|
|
163
|
+
},
|
|
164
|
+
requests: {
|
|
165
|
+
value: 1,
|
|
166
|
+
unit: 'USD/million requests',
|
|
167
|
+
layer: 'L2',
|
|
168
|
+
source: `aws.amazon.com/cloudfront/pricing/pay-as-you-go (web page read ${PRICES_READ}): HTTPS requests $0.0100 per 10,000 after 10 million free a month, times 100`
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'Microsoft Azure',
|
|
173
|
+
tier: 'default routing from North America or Europe; the next 10 TB after the first free 100 GB',
|
|
174
|
+
page: 'azure.microsoft.com/en-us/pricing/details/bandwidth',
|
|
175
|
+
egress: {
|
|
176
|
+
value: 0.087,
|
|
177
|
+
unit: 'USD/GB',
|
|
178
|
+
layer: 'L0',
|
|
179
|
+
source: `azure.microsoft.com/en-us/pricing/details/bandwidth (web page read ${PRICES_READ}): Microsoft Premium Global Network, $0.087 per GB for the next 10 TB`
|
|
180
|
+
},
|
|
181
|
+
bytesPerUnit: 1e9,
|
|
182
|
+
freeAllowance: {
|
|
183
|
+
value: 100,
|
|
184
|
+
unit: 'GB/month',
|
|
185
|
+
layer: 'L0',
|
|
186
|
+
source: `azure.microsoft.com/en-us/pricing/details/bandwidth (web page read ${PRICES_READ}): first 100 GB a month free`
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: 'Google Cloud (Premium Tier)',
|
|
191
|
+
tier: 'to North America, 1 to 1,024 GiB a month, per GiB',
|
|
192
|
+
page: 'cloud.google.com/vpc/network-pricing',
|
|
193
|
+
egress: {
|
|
194
|
+
value: 0.12,
|
|
195
|
+
unit: 'USD/GiB',
|
|
196
|
+
layer: 'L0',
|
|
197
|
+
source: `cloud.google.com/vpc/network-pricing (web page read ${PRICES_READ}): Premium Tier data transfer out to North America, 1 to 1,024 GiB a month, $0.12 per GiB`
|
|
198
|
+
},
|
|
199
|
+
bytesPerUnit: 2 ** 30,
|
|
200
|
+
freeAllowance: {
|
|
201
|
+
value: 1,
|
|
202
|
+
unit: 'GiB/month',
|
|
203
|
+
layer: 'L0',
|
|
204
|
+
source: `cloud.google.com/vpc/network-pricing (web page read ${PRICES_READ}): first 1 GiB a month free`
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
];
|
|
208
|
+
/** Pantheon bills traffic in unique visits, which no per-view figure converts to */
|
|
209
|
+
export const PANTHEON_OVERAGE = {
|
|
210
|
+
value: 40,
|
|
211
|
+
unit: 'USD per 10,000 unique visits',
|
|
212
|
+
layer: 'L0',
|
|
213
|
+
source: `docs.pantheon.io/guides/account-mgmt/traffic/overages (web page read ${PRICES_READ}): a visit is an IP address and user agent over 24 hours; the page carries a notice that the automated overage program is paused`
|
|
214
|
+
};
|
|
215
|
+
/** the three tiers, named by the share of annual views served with zero network */
|
|
216
|
+
export const TIERS = { meaningful: 0.3, major: 0.65, transformative: 0.9 };
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { type Spread } from './derive.js';
|
|
2
|
+
import type { Row } from './measurement.js';
|
|
3
|
+
/** one lever of the ledger: the bytes it saves on each page of a corpus, in page order */
|
|
4
|
+
export type Lever = {
|
|
5
|
+
id: string;
|
|
6
|
+
/** where the lever stands: `default` is on once its parent option is set, `option` needs its own option, `max` is not built or needs a condition the corpus does not show */
|
|
7
|
+
status: 'default' | 'option' | 'max';
|
|
8
|
+
corpus: 'crawl' | 'trim';
|
|
9
|
+
/** the site of each page, in the same order as `bytes` */
|
|
10
|
+
sites: string[];
|
|
11
|
+
bytes: number[];
|
|
12
|
+
};
|
|
13
|
+
/** what a lever saves across a corpus, in bytes */
|
|
14
|
+
export type LeverStats = {
|
|
15
|
+
pages: number;
|
|
16
|
+
withSaving: number;
|
|
17
|
+
medianPage: number;
|
|
18
|
+
/** the median over the pages that save anything, or null when none do */
|
|
19
|
+
medianEligible: number | null;
|
|
20
|
+
/** the median over sites of each site's mean per page */
|
|
21
|
+
medianSite: number;
|
|
22
|
+
mean: number;
|
|
23
|
+
};
|
|
24
|
+
export type CrawlImageRow = {
|
|
25
|
+
kind: 'image';
|
|
26
|
+
site: string;
|
|
27
|
+
profile: string;
|
|
28
|
+
page: string;
|
|
29
|
+
bytes: number;
|
|
30
|
+
format: string;
|
|
31
|
+
arms: {
|
|
32
|
+
native?: {
|
|
33
|
+
bytes: number;
|
|
34
|
+
};
|
|
35
|
+
ceiling?: {
|
|
36
|
+
bytes: number;
|
|
37
|
+
} | null;
|
|
38
|
+
resized?: {
|
|
39
|
+
bytes: number;
|
|
40
|
+
} | null;
|
|
41
|
+
lossless?: {
|
|
42
|
+
bytes: number;
|
|
43
|
+
} | null;
|
|
44
|
+
} | null;
|
|
45
|
+
};
|
|
46
|
+
export type CrawlPageRow = {
|
|
47
|
+
kind: 'page';
|
|
48
|
+
site: string;
|
|
49
|
+
profile: string;
|
|
50
|
+
variant: 'original' | 'lazy';
|
|
51
|
+
page: string;
|
|
52
|
+
ok: true | string;
|
|
53
|
+
imageBytesLoad: number;
|
|
54
|
+
imageBytesScroll: number;
|
|
55
|
+
videoBytes: number;
|
|
56
|
+
videoTags: Array<{
|
|
57
|
+
autoplay: boolean;
|
|
58
|
+
}>;
|
|
59
|
+
iframes: Array<{
|
|
60
|
+
host: string;
|
|
61
|
+
bytes: number;
|
|
62
|
+
}>;
|
|
63
|
+
lcp: {
|
|
64
|
+
tag: string | null;
|
|
65
|
+
loading: string | null;
|
|
66
|
+
} | null;
|
|
67
|
+
};
|
|
68
|
+
export type CrawlEmbedRow = {
|
|
69
|
+
kind: 'embed';
|
|
70
|
+
provider: 'youtube' | 'vimeo';
|
|
71
|
+
arm: 'iframe' | 'facade';
|
|
72
|
+
bytes: number;
|
|
73
|
+
docBytes: number;
|
|
74
|
+
};
|
|
75
|
+
/** the bytes a WebP of each image saves: `native` is the file at its own size, `ceiling` the width ceiling, `resized` the rendered width */
|
|
76
|
+
export declare function imageSavings(rows: readonly CrawlImageRow[]): {
|
|
77
|
+
format: number;
|
|
78
|
+
resize: number;
|
|
79
|
+
lossless: number;
|
|
80
|
+
};
|
|
81
|
+
/** the levers of the image-crawl corpus: the first views of the desktop profile, one entry per page */
|
|
82
|
+
export declare function crawlLevers(rows: readonly Row[]): Lever[];
|
|
83
|
+
/** bytes of image data a visit that never scrolls does not load when `loading="lazy"` is on, by page */
|
|
84
|
+
export declare function lazyUnscrolled(rows: readonly Row[], profile?: string): {
|
|
85
|
+
pairs: number;
|
|
86
|
+
sites: string[];
|
|
87
|
+
bytes: number[];
|
|
88
|
+
baseLoad: number[];
|
|
89
|
+
lazyLoad: number[];
|
|
90
|
+
lcpImagePages: number;
|
|
91
|
+
lcpLazyPages: number;
|
|
92
|
+
};
|
|
93
|
+
/** the levers of the trim corpus: the first views of internal pages of the Drupal sites */
|
|
94
|
+
export declare function trimLevers(trimmed: readonly Row[], crawl: readonly Row[]): Lever[];
|
|
95
|
+
/** {@link LeverStats} of a lever's per-page bytes, or null for an empty corpus */
|
|
96
|
+
export declare function leverStats(sites: readonly string[], bytes: readonly number[]): LeverStats | null;
|
|
97
|
+
/** the bytes of several levers added page by page; the levers must come from one corpus and one page order */
|
|
98
|
+
export declare function addLevers(levers: readonly Lever[]): {
|
|
99
|
+
sites: string[];
|
|
100
|
+
bytes: number[];
|
|
101
|
+
} | null;
|
|
102
|
+
/** the dictionary choices the `dictionary-size` rig measures; see that rig for what each one is */
|
|
103
|
+
export declare const DICTIONARY_ARMS: readonly ["oracle", "browser", "serverVisit", "serverHeld", "serverOut"];
|
|
104
|
+
/** one of {@link DICTIONARY_ARMS} */
|
|
105
|
+
export type DictionaryArm = (typeof DICTIONARY_ARMS)[number];
|
|
106
|
+
/** what one dictionary choice saves against brotli 11 alone, with a file that gains nothing served plain */
|
|
107
|
+
export type DictionaryStat = {
|
|
108
|
+
/** the median over sites of the share of that site's brotli 11 bytes saved */
|
|
109
|
+
medianSite: number;
|
|
110
|
+
/** the same share over every file of every site */
|
|
111
|
+
pooled: number;
|
|
112
|
+
/** internal pages */
|
|
113
|
+
pages: number;
|
|
114
|
+
/** the median bytes saved on an internal page's first view */
|
|
115
|
+
medianPageBytes: number;
|
|
116
|
+
/** internal pages whose new files save more than 5% of their brotli 11 bytes */
|
|
117
|
+
pagesOver5: number;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* The savings of each dictionary choice in a `dictionary-size` reading, for `dcz` (zstd) and `dcb`
|
|
121
|
+
* (brotli). A file the choice gives no dictionary, or whose delta is not smaller than brotli 11,
|
|
122
|
+
* saves nothing.
|
|
123
|
+
*/
|
|
124
|
+
export declare function dictionaryArms(rows: readonly Record<string, unknown>[]): {
|
|
125
|
+
sites: number;
|
|
126
|
+
files: number;
|
|
127
|
+
br11Bytes: number;
|
|
128
|
+
arms: Record<"oracle" | "browser" | "serverVisit" | "serverHeld" | "serverOut", {
|
|
129
|
+
zstd: DictionaryStat;
|
|
130
|
+
br: DictionaryStat;
|
|
131
|
+
}>;
|
|
132
|
+
};
|
|
133
|
+
/** the windows of one arm that a derivation keeps and drops, and why */
|
|
134
|
+
export type WindowCount = {
|
|
135
|
+
kept: number;
|
|
136
|
+
/** other containers used more than the limit of CPU per second */
|
|
137
|
+
dropped: number;
|
|
138
|
+
/** the window belongs to a round whose idle windows disagree (idle-activity only) */
|
|
139
|
+
idleControl: number;
|
|
140
|
+
};
|
|
141
|
+
/** kept and dropped windows per arm under the contamination limit; a row with no length (a probe) is not a window */
|
|
142
|
+
export declare function windowCounts(rows: readonly Row[], limit?: number): Record<string, WindowCount>;
|
|
143
|
+
/** the idle windows of a round may differ by this factor, largest over smallest, before the round is dropped */
|
|
144
|
+
export declare const IDLE_AGREEMENT = 1.25;
|
|
145
|
+
/** one arm of an idle-activity reading, after the drops */
|
|
146
|
+
export type ActivityArm = {
|
|
147
|
+
windows: number;
|
|
148
|
+
/** package watts over the kept windows */
|
|
149
|
+
watts: Spread;
|
|
150
|
+
/** watts above the idle windows of the same round */
|
|
151
|
+
extraWatts: Spread;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Package watts per arm of an idle-activity reading. A window is dropped when other containers used
|
|
155
|
+
* more than `limit` ms of CPU per second. The rig cannot see a host process or a container that
|
|
156
|
+
* stopped inside a window, so the three idle windows of each round also act as a control: when the
|
|
157
|
+
* largest of them is over {@link IDLE_AGREEMENT} times the smallest, the whole round is dropped. An
|
|
158
|
+
* arm with no kept window is null.
|
|
159
|
+
*/
|
|
160
|
+
export declare function activityFigures(rows: readonly Row[], limit?: number): {
|
|
161
|
+
idleWatts: Spread | null;
|
|
162
|
+
noisyRounds: number[];
|
|
163
|
+
counts: Record<string, WindowCount>;
|
|
164
|
+
arms: Record<string, ActivityArm | null>;
|
|
165
|
+
};
|
|
166
|
+
/** attributional joules for `bytes` (the same SWD v4 rate as the headline, no origin term: these are the same requests with fewer bytes) */
|
|
167
|
+
export declare const ledgerJoules: (bytes: number) => number;
|
|
168
|
+
/** megawatt-hours a year when `perView` joules are saved on a share of `views` views */
|
|
169
|
+
export declare const ledgerMWh: (perView: number, views: number, share: number) => number;
|