interplane.Get Omega
Read in your language

cortex

aien-dev/cortex

Brought by drakestapleton

branch main Branches Tags History

cortex / evidence / brain / stats.txt

117 lines · 10425 bytes Raw Blame History
1Company Brain load statistics, computed by the Wolfram Language evaluator (Wolfram MCP) from the raw
2files in this directory (tests/brain/load.sh, 2026-11-11T13:26:59Z, server sha256 9ee53460...).
3Query (w and r = the full integer lists of lat-write.ns and lat-read.ns, values in ns, results in ms):
4 {With[{d=N[w/10^6]},{Length[d],Quantile[d,1/2],Quantile[d,99/100],Mean[d],Max[d]}],
5 With[{d=N[r/10^6]},{Length[d],Quantile[d,1/2],Quantile[d,99/100],Mean[d],Max[d]}]}
6Quantile uses Wolfram's default definition (no interpolation: the sample element at rank ceil(q n)).
7Client: pdrive (tests/parity/pdrive.om), one HTTP/1.1 connection per request, sequential.
8Fixture: the cortex-rs snapshot of 2026-10-26 (6641 entities, sqlite file sha256 8f3be027...),
9imported with cortex-import; the committed evidence/load baseline used a 6327-entity copy of the same
10database. The Brain space holds the 2000 entries the write phase makes (every 10th supersedes the one
11before it); read-before asks for 5 entries per task.
12Conditions: one run under nice -n 19 / ionice idle on a shared 20-core host, load average 15.3 before
13and 15.7 after. One run: indicative, not a speed claim.
14
15file sha256(first 16) Wolfram output {n, p50, p99, mean, max} (ms)
16lat-write.ns 5b4198310b7185d4 {2000, 7.392489, 12.386809, 8.5959333775, 48.331081}
17lat-read.ns d1b201f47a5a7af4 {500, 8.448883, 10.072434, 8.491428710000001, 11.399888}
18
19Beside the existing baseline (evidence/load/stats.txt, read mix of search/recall/get/traverse):
20 lat-omega-seq.ns {4277, 1.530397, 21.284291, 4.270380842412907, 46.931099}
21 lat-oracle-seq.ns {4277, 1.73211, 25.139186, 4.591630356558336, 106.171239}
22Write-after is one appended log record with fdatasync before the 201, the same path as an entity
23write. Read-before rebuilds the supersede index of the space (it parses the metadata of every Brain
24entry of the space) and runs one ranked FTS query per request, so its cost grows with the number of
25entries in the space; the alarm in tests/brain/load.sh watches the store capacities, not latency.
26
27Calendar arithmetic of the alert gate (tests/brain/corpus1.tsv, corpus3.tsv), checked with the
28Wolfram Language evaluator; query and output:
29 d0={2026,11,11};
30 {DayCount[d0,{2026,11,20}],DayCount[d0,{2026,12,1}],DayCount[d0,{2026,12,31}],
31 DayCount[d0,{2027,6,30}],DayCount[{2028,2,1},{2028,2,29}],DayCount[d0,{2028,2,29}],
32 DayCount[d0,{2026,11,21}],DayCount[d0,{2026,11,25}],DayCount[{1970,1,1},d0],
33 DayCount[{1970,1,1},{2028,2,29}],DayCount[{1970,1,1},{0,3,1}],DayCount[{1970,1,1},{9999,12,31}],
34 LeapYearQ[{2028}],LeapYearQ[{2100}],LeapYearQ[{2000}]}
35 Out[1]= {9, 20, 50, 231, 28, 475, 10, 14, 20768, 21243, 719468, 2932896, True, False, True}
36So with date 2026-11-11: the tender deadline 2026-11-20 is day 9 (in at days=9, out at days=8), the
37framework expiry 2026-12-01 is day 20 (in at 20, out at 19), the amendment's hard expiry 2026-11-21 and
38on-completion date 2026-11-25 are days 10 and 14 (both in at 14, the on-completion date out at 13);
39from 2028-02-01 the leap day 2028-02-29 is day 28 (in at 28, out at 27). The answers in
40tests/brain/expected-*.rec carry these daysLeft values. Rule: integer day numbers since 1970-01-01 in
41the proleptic Gregorian calendar (om/brain.om bn_dfc / bn_fdate, Hinnant's civil algorithms); an alert
42fires for date <= keyDate <= date + days, both ends included.
43
44Read-before against the number of Brain entries in a space, before and after the live supersede index
45(2026-11-11, tests/brain/scale.sh; raw files in evidence/brain/scale/, run.txt names both binaries:
46before = 9ee53460... (main ffc90d99, index rebuilt on every request), after = fdf2190c... (index
47kept live, rebuilt only after a start, retract or hard delete)). One log with three spaces of 1,000,
4810,000 and 100,000 entries (111,000 in all, every 10th superseding the one before it), each binary on
49its own copy; one warm-up read per space, then 200 sequential reads (limit 5) per space, all 200 answered
50"supported":true. Shared 20-core host, load average 13 to 21 during the run: indicative.
51Query (b1, b10, b100, a1, a10, a100 = the integer lists of lat-before-s1k.ns ... lat-after-s100k.ns):
52 st[d_]:=With[{x=N[d/10^6]},{Length[x],Quantile[x,1/2],Quantile[x,99/100],Mean[x]}];
53 {st[b1],st[b10],st[b100],st[a1],st[a10],st[a100]}
54Wolfram output {n, p50, p99, mean} (ms):
55 before s1k {200, 78.997071, 84.701893, 79.45715123}
56 before s10k {200, 82.814019, 93.961658, 83.18259480500001}
57 before s100k {200, 124.038034, 139.869718, 124.5131774}
58 after s1k {200, 78.785277, 87.545374, 79.16876820499999}
59 after s10k {200, 79.248241, 90.876685, 80.03740970499999}
60 after s100k {200, 85.986096, 114.088757, 88.15236171500001}
61Reading: the per-request rebuild cost grew with the space (+45 ms p50 from 1,000 to 100,000 entries);
62with the live index the space size adds 7 ms p50. What remains, about 79 ms at every size here, is
63proportional to the whole store (111,000 entities): the ranked FTS query (om/fts.om scores every
64document holding a task word, all spaces, before the space filter) and the per-request live filter
65over every entity slot. That is the existing search path's design (cx_fts_run does the same) and is
66the next thing to make incremental (a per-space posting filter and a live bitmap kept by writes).
67
68Read before and ranked search after the incremental FTS index, against the cortex-rs 0.1.0 oracle
69(2026-11-11, tests/brain/bench.sh, 3 rounds; raw files in evidence/brain/bench/, run.txt and bench.log
70name the binaries and the checks). One store of 111,000 entities written through the oracle (spaces
71s1k, s10k, s100k with 1,000 / 10,000 / 100,000 Brain entries, every 10th superseding the one before),
72imported once for the Omega arms. In each round the arms ran one after the other, each started fresh:
73oracle (cortex-rs 0.1.0, saved binary), before (Radicle main e869009a), after (the incremental index).
74Per space: 200 read-before requests (Omega only; the oracle has no Brain routes), 200 GET searches with
75the same task text (no phrase match: FTS, then the substring fallback), 200 GET searches for
76"<topic> note" (a two-word phrase held by a fifth of each space, ranked by bm25); limit 5, one HTTP/1.1
77connection per request (pdrive). Whole run under the pool lock pool-19, pinned to core 19 (taskset), on a
78shared host (load average 18 to 23 at the end). Every read was supported, before and after answers were
79byte-identical (elapsedMs and the date header aside), the oracle's and Omega's searches named the same
80entities in the same order (bench.log: 45 PASS lines, ALL PASS).
81Query (Wolfram Language evaluator; L[arm, kind, space, round] = the full integer list of
82r<round>/lat-<arm>-<kind>-<space>.ns, values in ns, results in ms):
83 st[d_]:=With[{x=N[d/10^6]},{Length[x],Quantile[x,1/2],Quantile[x,99/100],Mean[x]}];
84 a=<|"arm/kind/space"->{L[..,1],L[..,2],L[..,3]}, ...|>;
85 Map[{st[Flatten[#]],Map[Quantile[N[#/10^6],1/2]&,#]}&,a]
86Wolfram output {n, p50, p99, mean} of the three rounds pooled, then the p50 of each round (ms):
87 before/rank/s1k {600, 15.830974, 16.749305, 15.866519203333334} rounds {15.958218, 15.743468, 15.753761}
88 after/rank/s1k {600, 6.889277, 8.138939, 6.958807794999999} rounds {6.751404, 7.004832, 6.860703}
89 oracle/rank/s1k {600, 75.881661, 85.933452, 76.48467670666666} rounds {73.449259, 75.537449, 81.60642}
90 before/rank/s10k {600, 15.529175, 16.880779, 15.641435395000002} rounds {15.523687, 15.303386, 15.89605}
91 after/rank/s10k {600, 8.058024, 9.307618, 8.109762333333332} rounds {8.095495, 8.048729, 8.025738}
92 oracle/rank/s10k {600, 75.305149, 85.436632, 75.68612799666667} rounds {74.195714, 73.7179, 80.501196}
93 before/rank/s100k {600, 15.949843, 17.317357, 16.06574794666667} rounds {16.015757, 16.488341, 15.712113}
94 after/rank/s100k {600, 14.913875, 16.783239, 14.967161603333334} rounds {15.110245, 14.681477, 14.814553}
95 oracle/rank/s100k {600, 84.589385, 92.198149, 84.57427098} rounds {84.981533, 85.55444, 83.213271}
96 before/read/s1k {600, 77.817519, 80.547377, 77.92919104166667} rounds {77.86944, 78.047848, 77.557413}
97 after/read/s1k {600, 0.190658, 0.320578, 0.19568001166666665} rounds {0.189842, 0.19349, 0.190002}
98 before/read/s10k {600, 78.300542, 80.722251, 78.39626892333334} rounds {78.256663, 78.63568, 78.006492}
99 after/read/s10k {600, 0.853672, 1.155578, 0.8675223016666667} rounds {0.852664, 0.865544, 0.843751}
100 before/read/s100k {600, 84.192863, 86.227313, 83.72403749333333} rounds {83.941037, 84.096405, 84.450361}
101 after/read/s100k {600, 8.206458, 9.107074, 8.261204096666667} rounds {8.230921, 8.245995, 8.128827}
102 before/search/s1k {600, 21.744899, 22.884525, 21.786113394999997} rounds {21.714108, 21.762754, 21.747511}
103 after/search/s1k {600, 0.195538, 0.270979, 0.19891575833333333} rounds {0.195602, 0.196658, 0.19381}
104 oracle/search/s1k {600, 0.349715, 0.617798, 0.36367273333333333} rounds {0.350051, 0.349027, 0.349747}
105 before/search/s10k {600, 25.621311, 26.916072, 25.622418516666666} rounds {25.34022, 25.60575, 25.849821}
106 after/search/s10k {600, 1.196874, 1.668367, 1.2234674849999998} rounds {1.193979, 1.234076, 1.183259}
107 oracle/search/s10k {600, 4.9655, 7.948984, 5.210385639999999} rounds {3.875366, 4.948076, 6.496459}
108 before/search/s100k {600, 66.36194, 68.310294, 66.38980758499999} rounds {66.119747, 66.507097, 66.437204}
109 after/search/s100k {600, 15.299658, 16.301903, 15.216725733333332} rounds {15.530632, 15.422028, 15.006778}
110 oracle/search/s100k {600, 77.692548, 82.976689, 77.62872117166667} rounds {76.8095, 77.56192, 78.936383}
111Reproduction of the reported floor before the change (tests/brain/scale.sh on main e869009a, both arms
112the same binary fdf2190c..., 200 reads per space, 2026-11-11T16:12:10Z; files in evidence/brain/bench/floor/),
113same query: p50 78.946 / 79.009 ms (1,000), 79.725 / 80.295 ms (10,000), 85.720 / 87.251 ms (100,000).
114Reading: what is left grows with the rows that match. Read before in s100k ranks the 90,000 live entries
115(each holds task words such as "region" and "client"); the plain search reads every entry of the
116space in the substring fallback, as SQLite does; the ranked phrase needs its store-wide hit count for
117bm25, counted over the 22,200 rows that hold its rarer word in all three spaces.