Hardware
A small site runs on a VPS with 1 GB of memory and two cores: Docker Compose’s tiny setup is tuned for that, and CI runs the end-to-end tests on every change with the stack limited to it. More memory mostly buys a bigger database cache, which matters once the database outgrows it. The tagger needs about 1 GB more; its page has its numbers.
Numbers marked measured come from moekura admin bench-http and admin bench (see Scaling) against the tiny stack, with the app
and PostgreSQL containers limited to 384 MB and 512 MB of memory and two
cores each, on an AMD Ryzen 7 7800X3D with an NVMe SSD, with release
0.5.0 unless a row says otherwise. The posts were generated by admin seed, with comments, notes, pools and favorites, but no files.
What CI checks
These are promises, not just measurements: CI runs the tiny stack with the limits above (on GitHub’s runners, which are slower than the machine above) and fails a change that breaks one of them.
moekura serveuses under 64 MB right after it starts,- and never more than 150 MB: through the end-to-end tests, a burst of 32 requests at a time to every page, and, on the main branch, all that again with 200,000 posts;
- with 200,000 posts, every page and API response in
admin bench-httpanswers in under 100 ms at the 95th percentile, one request at a time (on the main branch); - nothing runs out of memory or restarts.
Memory
Measured:
| Right after start | After the e2e tests | 200,000 posts, after a burst of requests | |
|---|---|---|---|
moekura serve (web and jobs), at its peak | 40 MB | 88 MB | 88 MB |
| PostgreSQL (the compose settings) | 54 MB | 133 MB | 294 MB |
moekura serve stays under 150 MB; CI fails if it doesn’t. PostgreSQL
grows to its shared_buffers (128 MB in the compose file) plus what its
connections use. Making thumbnails runs vips and ffmpeg for a moment
per upload, which for large images and videos takes some more; see
Limits on media tools to
bound it.
That leaves about 150 MB of a 1 GB machine for the system and for the operating system’s file cache. Adding swap is a cheap safety net.
Speed
Measured, p95 in milliseconds for one request at a time:
| Posts (database size) | Pages and APIs | Searches |
|---|---|---|
| 100,000 (240 MB), before 0.5 | under 4 | not measured |
| 200,000 (520 MB) | under 5 | mostly under 25; a file type with a common tag 53 |
| 1,000,000 (2.1 GB), before 0.5, one core each | under 6 | mostly under 60 |
With the database four times the memory, most searches stay fast, but
the few that read many posts do not: a common word in notes (note:)
takes about 0.9 s, a user’s saved searches (search:all) 0.4 s, a file
type with a common tag 0.25 s, and pool:any and tagger suggestions
(ai:) about 0.1 s. For a site that size, 2–4 GB of memory should keep
the database cached and bring those back under 100 ms, as they are for
5,000,000 posts on a large machine on the Scaling page
(estimated).
5,000,000 posts
Measured with 0.5.0 on the whole machine (16 threads, 32 GB of memory),
PostgreSQL given shared_buffers = 4GB, an 11 GB database: every page
and API response’s p95 was under 5 ms one request at a time and under
11 ms sixteen at a time, and moekura serve peaked at 51 MB. Searches
were mostly under 40 ms, the slowest a user’s saved searches (0.1 s) and
a common word in notes (77 ms). Scaling
has each search and page.
Seeding shows what writing costs: about 1,250 posts a second on two cores (1,350 on the whole machine), database work only.
Disk
- Database: about 2 KB per post measured, with a site’s worth of tags, comments, notes and tagger suggestions (2.1 GB for 1,000,000 posts).
- Files: the originals, plus thumbnails and, for large images, a
sample; estimated at 20–30% on top of the originals, depending on
media.thumbnail_sizesandmedia.sample_size. - Images: about 180 MB for Moekura’s and 300 MB for PostgreSQL’s.
An SSD matters more than cores: searches that miss the cache read pages from disk at random.
Raspberry Pi 4
Estimated, not measured: a Raspberry Pi 4 with 2 GB or more should run
the tiny setup (the images are built for arm64), its cores being a few
times slower than a desktop’s. Expect pages several times slower than
above, still well under a second for a small site. Keep the database on
an SSD over USB 3 rather than the SD card, which is slow at random reads
and wears out. If you run one, moekura admin bench-http measures it.