Capacity Planning
What DBTrail uses in memory, CPU and disk, measured on a real deployment, and how big a machine to start with.
One daemon captures, indexes and rotates. The index MySQL holds the state: size that.
The machine that runs DBTrail needs at least 4 physical cores and 16 GB of memory for production; 8 cores and 32 GB are recommended. Count cores, not vCPUs: on most Intel and AMD cloud instances a vCPU is half a core, so 4 cores are 8 vCPUs (on AWS Graviton and the AMD c7a, m7a and r7a families, one vCPU is one core). 8 GB is for evaluating DBTrail on a small database. How big a machine has the details.
The figure below is what capture alone uses on a quiet machine, not a size to plan for: SQL on the copy needs the cores and memory above.

Disk

Per-change cost grows with row width and with binlog_row_image=FULL. Filtering schemas cuts it.
Watch the index disk
Status → Index disk shows free space and time until full; bintrail doctor prints days until full. A full disk stalls capture, and once the source purges its binlogs the gap is permanent. Status
Disk for a full read of MySQL
A full read of a MySQL or MariaDB server (Read database now, or a scheduled full read) first writes the whole database as an uncompressed dump into the working folder, and only then converts it to Parquet. The dump is deleted when the run ends. This is disk on the DBTrail host, not on the database server.
Free space at the working folder should be at least the size of the dumped tables (data plus indexes), and about 1.8× that when the Parquet goes to the same disk and the data is mostly binary or random.
Before mydumper starts, DBTrail adds up DATA_LENGTH and INDEX_LENGTH of
every table it is about to dump and compares them with the free space at the
working folder:
| Free in the working folder | What happens |
|---|---|
| Less than half the size of the data, not counting indexes | The read is refused before anything is dumped. No measured dump came to less than that: the smallest, apart from a table with most of its rows deleted, was 0.89× its data |
| Less than the data plus the indexes | The read runs, with a warning that the dump may not fit |
| Less than 1.8× the data plus the indexes, with the Parquet on the same disk as the working folder | The read runs, with a warning that the dump plus its Parquet may not fit |
| The sizes or the free space cannot be read | The read runs, and says the check did not run |
A warning is about that read. Once the read has written its snapshot the note says "This read fit. The next one may not."
The numbers come from one synthetic measurement: MySQL 8.4, mydumper 1.0.5
with the flags DBTrail passes, five tables of different shapes, one machine.
It is not yet confirmed on real datasets. Ratios are against DATA_LENGTH + INDEX_LENGTH:
| Table shape | Dump ÷ (data + indexes) | Peak (dump + Parquet) ÷ (data + indexes) |
|---|---|---|
| Random strings, 1 secondary index | 0.82 | 1.21 |
| Numbers and dates, 3 secondary indexes | 0.60 | 0.75 |
| Repetitive text and JSON | 0.98 | 1.02 |
| Random binary | 0.95 | 1.80 |
| 90% of rows deleted | stale sizes | stale sizes |
The dump alone stayed below the data plus the indexes in every case. With the Parquet on the same disk, data that does not compress peaked at up to 1.8×. The table with 90% of its rows deleted reported its sizes from before the delete, so the estimate was too high, not too low.
- Where the working folder is: with nothing set,
baseline-stagingbeside DBTrail's own data (/var/lib/bintrail/baseline-stagingin the Compose stack). Move it withBINTRAIL_CONSOLE_BASELINE_STAGING, orconsole-baseline-stagingin the option file, then restart DBTrail:console-baseline-staging. - Another disk: when the server's Local folder is on another disk, the working folder only has to hold the dump, and a small Local folder is a warning, never a refusal. Another disk means another filesystem: btrfs subvolumes, ZFS datasets and thin LVM volumes draw from one pool, so on those the 1.8× margin is yours to keep.
- Several reads at once: full reads of several servers that run at the same time share one working folder, and each check sees the whole free space, not what is left after the others. Size the folder for the reads you let overlap.
- Compressed tables: a table with
ROW_FORMAT=COMPRESSED, or one in MyRocks, reports its compressed size and is dumped uncompressed, so the sizes above are not a bound for it. The check counts those tables and names the two largest, and when the free space covers the reported sizes its note opens with "Disk check cannot tell whether this read fits" instead of saying there is room. - If the folder fills anyway: the read fails and is recorded as a disk failure. The partial dump is deleted, no new snapshot is made and earlier ones are unchanged. A scheduled full read is tried again at its next time, not sooner.
- Before the first read, from the command line:
bintrail doctor --source-dsn … --staging-dir <folder>reads the same table sizes and compares them with the free space of that folder. It measures the folder on the machine doctor runs on, sizes the tables--schemasselects, and never changes doctor's exit code. - Not checked: a dump you run yourself with
bintrail dump.
Disk for a PostgreSQL snapshot
A snapshot of a PostgreSQL server has no dump. Each table is copied straight into a Parquet file in the server's Local folder, so the working folder is not involved and the Local folder is the one that has to have the room.
Before a snapshot starts (the first copy after server add, Read database
now, snapshot run, a scheduled full read), DBTrail adds up pg_table_size
of every table the snapshot copies: the heap and its TOAST, without indexes,
and a partitioned table by its partitions. It compares the sum with the free
space of the Local folder:
| Free in the Local folder | What happens |
|---|---|
| Less than 1 GiB | The snapshot is refused before anything is read, and before the replication slot is created. The message gives what is free, the 1 GiB, and the size of the tables |
| Less than 1.3× the tables' size | The snapshot runs, with a warning that it may fail with a full disk. Once it has written its snapshot the note says "This read fit. The next one may not." |
| The sizes or the free space cannot be read | The snapshot runs, and says the check did not run |
The 1 GiB is the room DBTrail keeps free when it writes a snapshot update, so below it no update would be written afterwards either.
The size of the tables alone never refuses, because a snapshot is compressed
(zstd) and how much depends on the data. Measured on PostgreSQL 16, as the
snapshot's size over pg_table_size:
| Table | Snapshot / table size |
|---|---|
| The same text in every row | 0.007× |
| Order rows (numbers, a status, dates, short text) | 0.22× |
| Long text PostgreSQL already compressed in TOAST | 0.20× |
| Random hex text, half the rows deleted | 0.31× |
| Random UUIDs and numbers | 0.65× |
| Random hex text | 0.69× |
Random bytea (written as hex) | 1.22× |
The warning uses the highest ratio measured, rounded up: it comes early for ordinary data and was not late for any of these.
- Tables the sizes say little about: one kept by a table access method
other than PostgreSQL's own heap (a columnar or compressed store), one with
child tables by inheritance (
INHERITS, or a TimescaleDB hypertable), and a foreign table among a partitioned table's partitions. The check counts those tables and names the two largest, and when the free space covers the reported sizes its note opens with "Disk check cannot tell whether this snapshot fits" instead of saying there is room. The same goes for a table the server gave no size for. - Where you see it: the snapshot's status, its run history and detail, the schedule card, and the message after a snapshot you started yourself. A refusal is recorded as a disk failure, so the schedule does not answer it with another full read into the same disk.
- More room: free space in the snapshot folder, or give the server a Local folder on a bigger disk (Snapshots, under Where and how often: Backup settings).
- From the command line,
bintrail-pg baselinewrites where--outputsays and does not run this check, andbintrail-pg doctordoes not report it.
How retention works

Archive compression
zstd by default, snappy and gzip supported. S3 keeps archives per your bucket lifecycle rules. Settings: Retention.
Lag
Change on the source to row in the index: sub-second for typical OLTP, hundreds to low thousands of writes per second. A checkpoint is saved every 10 seconds (--checkpoint); restart resumes from it.
What affects lag
- Bulk writes: large INSERTs, batch UPDATEs
- Wide rows: big TEXT or BLOB columns
- Network distance or an SSH tunnel to the source
- Index disk speed: SSD; very write-heavy sources may need provisioned IOPS
Restart policy: systemd or Docker (restart: unless-stopped in the bundled stack). Binlogs purged past the checkpoint: take a fresh snapshot.
A busy server, measured
One source at 5,200 row changes a second, on 16 vCPU and 128 GB.
| Small install | Busy server | |
|---|---|---|
| Row changes | 255,000 a day | 450 million a day |
| Source binlog | under 1 GB a day | 150 GB a day |
| Index disk | 128 MB a day | 21 GB an hour |
| Index MySQL buffer pool | default | 48 GB |
| Daemon memory | 93 MB | 0.5 GB idle, 3 to 12 GB during an update |
| Capture lag | under a second | none, up to 15,500 changes a second |
Rules of thumb
- Index disk: 1.1 KB per row change, about three times the binlog.
- Index MySQL: give it memory first. With the default 128 MB buffer pool it captured 1,400 changes a second. With 48 GB, 16,000. How to set it: below.
- First copy: 100 million rows in 5 to 7 minutes.
- Parquet copy: 7 to 18 times smaller than the tables in MySQL.
- Each update: 15 to 30 seconds while the busiest table changes under a million rows per update.
Measured with DBTrail 0.98.0 under a sysbench-tpcc load, on a 16,000 IOPS SSD.
Give the index MySQL memory
MySQL's default is a 128 MB buffer pool on any machine. On a busy source that caps capture at about 1,400 row changes a second, and the lag grows without end while the machine sits mostly idle. Nothing stops; the copy just falls further behind.
The bundled stack sizes it through INDEX_BUFFER_POOL in the .env next to
docker-compose.yml. A fresh install.sh writes it for you: a quarter of the
memory Docker has, whole gigabytes from 1G up, at most 32G. A quarter, not
more, because the SQL engine in the web interface takes up to 4 GB and your source
MySQL may run on the same machine. Raise it when the machine runs nothing else.
To set or change it on a stack you already have (the installer never rewrites a value you set, and a re-run only prints the line to add):
echo 'INDEX_BUFFER_POOL=8G' >> .env # whole GB, or e.g. 512M
docker compose up -d # restarts the index MySQL; capture resumes from its checkpointA docker-compose.yml from before v0.100.0 does not pass the value on. Take the
current file first:
Upgrading the stack.
bintrail doctor, the startup checklist and the server checks in the web interface
warn Index buffer pool when an index on this machine still runs with 128 MB and
the machine has about 4 GB or more. DBTrail only reads the setting; it never changes
your index. With your own MySQL as the index (INDEX_DSN), set
innodb_buffer_pool_size yourself, 50 to 70% of the RAM it has to itself.
How big a machine
| Physical cores | Memory | Index buffer pool | Disk | |
|---|---|---|---|---|
| Evaluation, one small database | 2 | 8 GB | 2 GB | 20 GB SSD |
| Production, minimum | 4 | 16 GB | 4 GB | from Disk |
| Production, recommended | 8 | 32 GB | 8 GB | from Disk |
| One busy server, 150 GB of binlog a day | 8 or more | 64 GB or more | 32 to 48 GB | 1 TB SSD without S3 |
- Cores, not vCPUs. SQL on the copy runs on cores, and two threads of one core do not add up to two cores: an analytical query is noticeably faster on 4 physical cores than on 4 vCPUs that are 2 cores. Capture and the snapshot refresh use the cores too; 8 leave them room without slowing the statements down.
- Memory is shared by the index MySQL's buffer pool, capture and the SQL statements. On 8 GB, a database of tens of GB under constant writes runs the machine out of memory, and capture is the first process to stop: a stopped capture is a gap in what you can recover.
- The index buffer pool column is the quarter of the memory
install.shwrites for you (see above). - Below the minimum, a problem caused by memory or CPU is not something we tune for.
Many clients on the MySQL port
Heavy queries on the copy use the cores. Once every worker is busy, more clients make the line longer, not the answers more frequent.
Numbers of one test setup on DBTrail 0.133.1, with the source taking 400 writes a second. The setup, the curves and how to work out your own ceiling: Many clients at once. From 0.139.1 the router takes 256 connected clients unless you raise it, and 1024 at most.
Next
Run on Amazon ECS
DBTrail as one Fargate task, with the index in your own MySQL, the saved state on EFS and the web interface behind a load balancer.
Many clients at once
How the MySQL port behaved from 10 to 2,000 connected clients on a 16-core machine while the source took 400 writes a second, and how to size for your own load.