Creating a repository took 26 s while Earth was busy issue #335 closed: completed andymccall opened this · 1 comment
andymccall set labels performance ·
andymccall
What /new waits on (2026-10-26): app.repos.create → Repo::init_bare_unbound, which does 16 fsyncs (strace of oxy init --bare): each of ~8 small files is written atomically (fsync the temp file, rename, fsync the directory), .oxy is fsynced 4 times and objects/loose 3 times. The work itself takes under a millisecond. On ext4 with data=ordered, every fsync forces a journal commit that waits for the disk's other dirty data, which at 12:01 was a 6 GB image export. So each fsync waited about a second, and the create took 26 s. It also runs synchronously on an async worker, so other requests on that thread waited with it.
Proposed, in order of value:
- Run heavy disk jobs on Earth (image exports and imports, big copies) under
ionice -c3 nice -n19, so the hub's fsyncs are not stuck behind them. This was the cause here; I'll do it from now on. - Hub: run
repos.create(andcreate_on,fork) inspawn_blocking, so a slow disk stalls only the request that writes, not the workers. - oxy-core:
initmakes its directory durable once at the end (fsync each new file, then each directory once), instead of after every file. That is about 8 fsyncs instead of 16; worth it only if creates are still slow under load after 1 and 2.
closed by change 15d3f6f7871b ·
Andy created andymccall/oxygenvcs-web at 12:01 (2026-10-26) and it 'took a while': the log has POST /new took 26.1 s (303). At the time Earth was at load 8-10 and its disk was saturated: Claude was exporting and importing a 6 GB Android image (oxygenflow#19) on the same disk as the hub's data, CI was running, and the hub logged 92 slow requests between 11:40 and 12:30 (coverage and receipt pages, flow claims up to 9 s). So most likely contention, not the create itself; still worth finding what /new waits on (durable writes, the tlog, Diffusion's index) so a create stays quick under load, and timing it on a quiet Earth.