backup, restore, merge, delete, and validate processes can be executed on several parallel threads. This can significantly speed up pg_probackup3 operation given enough resources (CPU cores, disk, and network bandwidth).
Parallel execution is controlled by the
-j/--threads and
--num-write-threads command-line options. These options
must be non-negative integers.
If --threads is not specified or set to zero,
pg_probackup3 defaults to the number of CPU
cores. If the core count cannot be determined, a single thread will be used.
If --num-write-threads is not specified, the number of
write threads will match the number of read threads.
If the requested threads exceed the system limit (e.g., from
/proc/sys/kernel/threads-max), a warning will be
displayed, and the system limit value will be used instead. If no limit is
found, the value specified by the user will be applied.
In the PRO mode, the number of read threads must be less than the value of
the max_wal_senders server parameter.
For example, to create a backup using four parallel threads, run the following command:
pg_probackup3 backup -Bbackup_dir--instance=instance_name-b FULL -j 4
Parallel restore applies only to copying data from the backup catalog to the data directory of the cluster. When Postgres Pro server is started, WAL records need to be replayed, and this cannot be done in parallel.
A technique is implemented that prevents repeatable copying of one file when pg_probackup3 runs on multiple threads. With this technique, however, when disks are slow or the system is overloaded, parallel copying might fail. To handle this situation, resolve issues with your system resources.