Mojourney

How it works

The census runs on one Hetzner CAX21 (4 ARM vCPUs, 8 GB, €12.49 a month), with a Mac as a morca remote worker for the git histories. There gharchive loads a day of GH Archive in about 1.5–3 minutes, peaking at 731 MB at the median and 801 MB at most, with about 2.4 cores busy (its Resources card, over the last 20 runs). It keeps only the index tables it derives from each hour, not the raw events, which were 97% of the bucket at about 1.1 GB a day. The backfill finished all 1,407 days, 2023-01-01 to 2026-11-07, on 2026-11-08.

How it got there

Since the first runs on AWS, newest last; each row links its pull request, whose description has the measurements.

ChangeWhat it didMeasuredPR
Bounded table historygharchive.events keeps a week of snapshots and every table its last 100 metadata files; morca_maintain expires the rest every day.–#20
Index events while parsingEach hour task writes candidates, repo_hour and releases from the events it parses, instead of a later pass over gharchive.events.Same rows as the old path for all 143,015 repos of 2023-01-10#21
Index tables committed once a dayThe three index tables get one commit each at the end of the day, with all the hours' files; only gharchive.events still committed every hour.Removes three of four hourly commits, which took about 1.7 s an hour (41 s of an 81 s day on AWS)#24
Smaller ParquetEvents sorted by (repo, type) and compressed with zstd 9; repo_hour merged into one sorted file a day.Events 311 to 227 bytes a row (−27%), repo_hour −24% over 3 merged hours; the hour task 2.35 to 2.80 s#29
An hour in about 450 MBA file's rows in fixed 4 MB string pieces, a sort of row numbers only, 16 MB row groups, and the download memory-mapped and released as it is decoded.A busy 2023 hour alone 965 to 525 MB; a day 1,969 MB and 52.9 s with 2 hours in flight, 1,826 MB and 38.9 s with 4 (Linux, 4 vCPU, 8 GB)#44 (#37)
4 hours in flightgharchive runs 4 hours at a time on the CAX21 instead of 2.1.8 GB at peak on a busy 2023 day, 26% faster than 2 (from #44)#59
Index only (GHARCHIVE_EVENTS=off)Stops writing gharchive.events, 97% of the bucket at about 1.1 GB a day; the index tables are unchanged.An hour in flight about 200 MB instead of 450 MB; the backfill went from about 22 to 58–65 days an hour on the CAX21 with two fill runs#70
Days with missing hoursA day loads without the hours GH Archive never published (a 404 more than 48 hours old), so the backfill could finish.–#78

The first runs, on AWS

Each hour's task was bound to one of the worker's four cores, with the Parquet write its largest stage. These changes spread the work over the cores and stopped copying it.

One gharchive hour on AWS

c7g.xlarge workers, about 85,000 events an hour, median of 24 hours.

StageBefore (run 36)After (run 48)
task1,094 ms680 ms
download172 ms130 ms
gunzip210 ms154 ms
parse160 ms134 ms
write570 ms256 ms
commit486 ms683 ms

Commit time grew with the table's snapshot count: run 133 measured 1,207 ms for the commit, at about 889 snapshots, with the other stages unchanged. Bounded history (#20) stopped the growth, the index tables now commit once a day (#24), and with the events off (#70) a day makes just those three commits.

The changes

ChangeWhat it didMeasured (Apple M4)PR
mojo-census #4Streams each hour through gunzip and parsing as it downloads, and writes Parquet on the workers.Six hours locally, 10.3 s to 4.5 s with 4 tasks#4
parquet #59Streams row groups, splits string pages by size, encodes pages on threads.50,000-row batch encode 198 to 81 ms (4 threads), peak 828 to 463 MB#59
iceberg #71Writes a batch without copying it.One hour 838–855 to 783–804 ms, peak 1.30–1.51 to 0.96–0.97 GB#71
iceberg #72Writes through the streaming writer on every core.One hour to 375 ms, peak about 0.5 GB (with #59, 4 threads)#72
deflate #10, #12Streaming inflate, and a faster decode loop.Gunzip of an hour 553 to 336 ms (1.46 GB/s)#10, #12
iceberg #70 + morca #114Workers hand their data files to the step to commit (append_files), which removes the census's own DataFile codec.–iceberg #70, morca #114