Public
Edited
Mar 6, 2023
Importers
Web latency - headless
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
/*
* Performs a dirty `fetch` to a RIPE Atlas anchor
*/
fetch_anchor = async (anchor, samples = constants().samples) => {
console.log(`https://${anchor}/`);

let dirty_rtts = [];

let bytes_rx = 0;
for (let i of [...Array(samples).keys()]) {
let t0 = new Date();

let rtt_tcp = await fetch(
// anchor's fqdn over HTTPS (with the new LE's cetificates)
`https://${anchor}/`,
{
mode: "no-cors"
}
);
let dt = new Date() - t0;
await wait(1000 - dt);
dirty_rtts.push(dt);
console.log(`rtt=${dt}ms`);

mutable total_bytes_rx += 255;
mutable requests_done++;
}

return { min: Math.min(...dirty_rtts), rtts: dirty_rtts };
}
Insert cell
Insert cell
Insert cell
select_points = (level) => {
let user_input = parseFloat(level); // 1.0;
let user_country_selection = {};
let points_by_country = group_array(mutable points, "country");

for (let [key, country_points] of Object.entries(points_by_country)) {
user_country_selection[key] = country_points.slice(
0,
Math.floor(country_points.length * user_input)
);
}

return Object.values(user_country_selection).flat();
}
Insert cell
Insert cell
measure = async (level) => {
// button;

let min = 1000;

mutable test_count = 0;
mutable requests_done = 0;
mutable total_bytes_rx = 0;

for (let point of select_points(level)) {
mutable current_point = point;

let res = await fetch_anchor(point.fqdn);

point.rtts ? point.rtts.push(res.min) : (point.rtts = [res.min]);

if (res.min < min) {
min = res.min;
mutable closest_point = point;
}

mutable test_count++;

await Promises.tick(1000);
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more