tracker
All repositories: gitoria
5.0 KB
// tests/realdata-074-bench.mjs — mission 025 (tracker#30: /my/* after the first-start jobs; a copy of realdata-071-bench.mjs with// the /my/ pages), NOT the gate: the big pages on a COPY of live// storage/, signed in as the creator (cookie from $REAL_SID_FILE), $REAL_LOADS (20) loads per page. Each load: the server's own// answer (node fetch, whole body) and the full browser load (to hydrated + visible images; Picard also clicks the cast "Show all"// and waits for "Show less"); the server's RSS after each load (/proc/$REAL_PID). Env: REAL_PORT, REAL_CHROME, REAL_SID_FILE,// REAL_PID, REAL_OUT (a .json with every number), REAL_LOADS, REAL_PATHS (only these, comma list of path prefixes). Procedure: STATUS.md mission 071.import { writeFileSync, readFileSync } from 'node:fs';import { launchBrowser } from './cdp.mjs';process.env.HL_CHROME ||= '/opt/google/chrome/chrome';const PORT = Number(process.env.REAL_PORT || 8758), BASE = `http://127.0.0.1:${PORT}`, LOADS = Number(process.env.REAL_LOADS || 20);const SID = readFileSync(process.env.REAL_SID_FILE, 'utf8').trim(), PID = process.env.REAL_PID;const rss = () => Math.round(Number(readFileSync(`/proc/${PID}/status`, 'utf8').match(/VmRSS:\s+(\d+)/)[1]) / 1024);const browser = await launchBrowser({ debugPortRange: [Number(process.env.REAL_CHROME || 8759), Number(process.env.REAL_CHROME || 8759)] });const page = await browser.newPage();await page.send('Emulation.setDeviceMetricsOverride', { width: 1280, height: 900, deviceScaleFactor: 1, mobile: false });await page.send('Network.setCookie', { name: 'trackersid', value: SID, url: BASE });const hydrated = () => page.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1 && document.readyState === "complete"', { timeout: 120000, label: 'hydrated' });const load = async (path, showAll) => {const t = Date.now(); await page.goto(BASE + path, { timeout: 120000 }); await hydrated();await page.waitFor(`Array.from(document.querySelectorAll('img')).filter(i => { const r = i.getBoundingClientRect(); return r.top < innerHeight && r.bottom > 0 }).every(i => i.complete)`, { timeout: 15000, label: 'images' }).catch(() => {});if (showAll) { await page.click('#casttoggle'); await page.waitFor(`document.querySelector('#casttoggle').innerText.includes('Show less')`, { timeout: 30000, label: 'show less' }); }return Date.now() - t;};const serverTime = async (path) => {const t = Date.now(); const r = await fetch(BASE + path, { headers: { cookie: 'trackersid=' + SID } }); const body = await r.text();return { ms: Date.now() - t, status: r.status, kb: Math.round(body.length / 1024) };};try {// a franchise page and a timeline from /franchises itself (the first ones listed; the seed makes timelines without a franchise)await load('/franchises');const hrefOf = (sel) => page.evaluate(`(document.querySelector('${sel}') || { getAttribute: () => null }).getAttribute('href')`);const franchise = await hrefOf('a.franchise-row'), timeline = await hrefOf('a.timeline-link');let PAGES = [['/my/series'], ['/my/shows'], ['/my/unwatched'], ['/my/movies'], ['/my/schedule'], ['/series'], ['/series/Star-Trek-Picard', true], ['/movies/Star-Trek-First-Contact'], ...(timeline ? [[timeline]] : [])];// REAL_PATHS (comma list): only these of the pages aboveif (process.env.REAL_PATHS) PAGES = PAGES.filter(([p]) => process.env.REAL_PATHS.split(',').some(x => p.startsWith(x)));const out = { pid: PID, rssStart: rss(), pages: [] };for (const [path, showAll] of PAGES) {const p = { path: path + (showAll ? ' + Show all' : ''), server: [], browser: [], rss: [], rows: null };const before = rss();for (let i = 0; i < LOADS; i++) {const s = await serverTime(path); if (s.status !== 200) throw new Error(path + ' answered ' + s.status);p.server.push(s.ms); p.kb = s.kb;p.browser.push(await load(path, showAll));p.rss.push(rss());}p.rows = await page.evaluate(`document.querySelectorAll('my-show-row, a.tile, a.timeline-item, a.franchise-row, a.timeline-link, episode-row, show-cast a.artist-link, a.unwatched-show, a.schedule-show').length`);const st = (a) => ({ avg: Math.round(a.reduce((x, y) => x + y, 0) / a.length), min: Math.min(...a), max: Math.max(...a), first5: Math.round(a.slice(0, 5).reduce((x, y) => x + y, 0) / 5), last5: Math.round(a.slice(-5).reduce((x, y) => x + y, 0) / 5) });p.sum = { server: st(p.server), browser: st(p.browser), rssBefore: before, rssAfter: p.rss[p.rss.length - 1] };out.pages.push(p);console.log(`${p.path.padEnd(42)} server avg ${p.sum.server.avg} ms (first5 ${p.sum.server.first5}, last5 ${p.sum.server.last5}, max ${p.sum.server.max}) browser avg ${p.sum.browser.avg} ms (first5 ${p.sum.browser.first5}, last5 ${p.sum.browser.last5}, max ${p.sum.browser.max}) RSS ${before} → ${p.sum.rssAfter} MB ${p.kb} kB, ${p.rows} rows`);}out.rssEnd = rss();console.log(`RSS over the whole run: ${out.rssStart} → ${out.rssEnd} MB`);if (process.env.REAL_OUT) writeFileSync(process.env.REAL_OUT, JSON.stringify(out, null, 1));} catch (e) { console.error(e); await browser.close().catch(() => {}); process.exit(1); }await browser.close();process.exit(0);
Branches
Latest commits
- 2ae8a47bMerge branch 'sk-sec'mre
- 8fee5d52sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
- 944ad51eSK: report reports/SK-sec.md, LOGsk
- 415487c1SK: import budget per user + id type check, gate checkssk
- 7b8a4f74security audit SK: nosniff + image sandbox headers, face id checks, adult follow, login budget + new session at login, guest-link budget, tests/security.mjssk
- f0f26c5areports: T18 section (gates, boot-gate, 3x3 table, search + short-id compare)mre
- 2a8682a1deploy.sh GATES: tests/warmstart.mjsmre
- 3761338breports/T17-boot.md: handoff (phase table, fix, numbers so far, open proof)mre
- 52e09eb2boot: sync window 1000 ms (the gates ask for a complete start), README boot-time sectionmre
- c87149e8tests/warmstart.mjs: the progressive start proven over HTTP (note in the window, 503 short id, after: everything); bootBeginmre
- 593a6350boot: resumable start-up scan, the server listens first (T17)mre
- be4890a0reports: H2 hydration audit (no test change needed)mre
- 1f9c8bf4re-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
- c1df88eddocker-compose: HL_GC_TABLE_LOAD=62 (tracker mission 048, T16 real-data numbers)mre
- d0a82867mission 048: report, LOG (HL_GC_TABLE_LOAD=62 measured)mre
- 2d4be66fre-vendor Hybriel 5df4eb7e (GC: HL_GC_TABLE_LOAD knob, mission 406)mre
- 99e7c8b9tests: realdata-m035-radii, repro-t38, realdata-060-backfill ports from env (REAL_PORT, REAL_CHROME, REPRO_CHROME), defaults unchangedmre
- 4625aa22re-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
- a6dfd6ecdeploy: person-lookup gate (tracker#46)mre
- 33ad4bd5Merge commit 'f57f64f'mre