Skip to content
Open
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fa94e6b
PBM-1715 Parallel file processing for backups and restores
rasika-chivate Jun 11, 2026
e022790
Added restore flag
rasika-chivate Jun 11, 2026
b36ea88
Update backup-physical.md
rasika-chivate Jun 11, 2026
c39a56d
Update restore-physical.md
rasika-chivate Jun 11, 2026
99db9e3
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
c21aad3
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
7ae0a39
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
aad2bf0
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
132ad22
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
f6fbad7
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
4181d3c
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
4b3fe64
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
53ab1e1
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
ffc30b4
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
303c5a3
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
94232ca
self review
rasika-chivate Jun 11, 2026
5ce1aa2
Remove extra trailing blank lines in backup options docs
Copilot Jun 11, 2026
b73439f
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
fdaa87d
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
4f9fc29
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
66f72da
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
b2d07f7
Add numParallelFiles to backup YAML example
Copilot Jun 11, 2026
d08cf9a
Remove trailing blank lines in restore options doc
Copilot Jun 11, 2026
f5c0f06
Add restore numParallelFiles to YAML example
Copilot Jun 11, 2026
aef469c
Add restore numParallelFiles to YAML example
Copilot Jun 11, 2026
2973877
Remove generated cache artifact and ignore .cache
Copilot Jun 11, 2026
c43bd8d
docs: add num-parallel-files to pbm backup flags
Copilot Jun 11, 2026
badea9e
Document --num-parallel-files for pbm restore
Copilot Jun 11, 2026
22d720f
Update backup-physical.md
rasika-chivate Jun 11, 2026
231d400
Potential fix for pull request finding
rasika-chivate Jun 11, 2026
d4d074d
Update backup-physical.md
rasika-chivate Jun 11, 2026
24216b9
Merge branch 'PBM-1715-Parallel-file-processing-for-backups-and-resto…
rasika-chivate Jun 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ venv/
# Local Netlify folder
.netlify
site
.cache/

styles/

Expand Down
12 changes: 12 additions & 0 deletions docs/reference/backup-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ backup:
startingStatus: 60
oplogSpanMin: <float64>
numParallelCollections: <int>
numParallelFiles: <int>
```

## priority
Expand Down Expand Up @@ -121,3 +122,14 @@ The duration (in minutes) of oplog slices saved with the logical backup snapshot
The number of parallel collections to process during a logical backup. By default, the number of parallel collections is half of the number of CPU cores. By setting the value for this option you define the new default.
Available starting with version 2.7.0.


## backup.numParallelFiles

*Type*: int <br>
*Default*: 1 <br>
*Storage*: Filesystem / NFS only <br>
Comment thread
rasika-chivate marked this conversation as resolved.
*Backup type:* Physical only
Comment thread
rasika-chivate marked this conversation as resolved.

The number of files to copy in parallel during a physical backup to filesystem or NFS storage.

The default value is `1`, which copies files sequentially.
2 changes: 2 additions & 0 deletions docs/reference/pbm-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The command accepts the following flags:
| `--compression`| Create a backup with compression. <br> Supported compression methods: `gzip`, `snappy`, `lz4`, `s2`, `pgzip`, `zstd`. Default: `s2` <br> The `none` value means no compression is done during backup. |
| `--compression-level` | Configure the compression level from 0 to 10. The default value depends on the compression method used. |
| `--num-parallel-collections`| Sets the number of collections to process in parallel during a specific logical backup. When undefined, `pbm-agent` processes the number of parallel collections defined for the `backup.numParallelCollections` configuration parameter. If that is undefined, the default number of collections to process in parallel is the half of the number of logical CPUs. Available starting with version 2.7.0.|
| `--num-parallel-files`| Sets the number of files to process in parallel during a specific physical backup. When undefined, `pbm-agent` uses the value defined for the `backup.numParallelFiles` configuration parameter. If that is undefined, the default number of files to process in parallel is `1`. |
| `-o`, `--out=text` | Shows the output format as either plain text or a JSON object. Supported values: `text`, `json` |
| `--wait` | Wait for the backup to finish. The flag blocks the shell session.|
| `--wait-time` | The time to wait for PBM to report the status of the command execution. Use this flag together with the `--wait` flag. You can specify the duration in minutes or hours (for example 5m, 1h). <br><br>When not set, PBM waits till the command executes. <br><br>If it takes longer than the defined waiting time to execute the command, PBM prints the `Operation is in progress. Check pbm status and logs` error message and unblocks the shell session. The `pbm-agent` continues to execute the command enabling you to track its progress via the `pbm status` command. Available starting with version 2.6.0.|
Expand Down Expand Up @@ -940,6 +941,7 @@ The command accepts the following flags:
| `--with-users-and-roles` | Restores users and roles created in custom databases during selective restore. Use this flag with the `--ns` flag. Available starting with version 2.5.0.|
| `-c`, `--config` | The path to the `mongod.conf` file |
| `--num-parallel-collections`| Sets the number of collections to process in parallel during a specific logical restore. When undefined, `pbm-agent` processes the number of parallel collections defined for the `restore.numParallelCollections` configuration parameter. If that is undefined, the default number of collections is the half of the number of logical CPUs. Available starting with version 2.7.0.|
| `--num-parallel-files` | Sets the number of files to copy in parallel during a specific physical restore. When undefined, PBM uses the value configured for the `restore.numParallelFiles` option. |
Comment thread
Copilot marked this conversation as resolved.
Outdated
| `--num-insertion-workers-per-collection`| Specifies the number of insertion workers to run concurrently per collection. Increasing the number for large import may increase the speed of the import. Available starting with version 2.8.0.|
| `--ns-from`="database.collection" |Specifies the name of the collection you want to restore under a new name. It indicates the collection present in the backup that you are targeting for restoration. Available starting with version 2.8.0.|
| `--ns-to`="database.collection" | Specifies the new name for the collection you are restoring from the original one. Available starting with version 2.8.0.|
Expand Down
15 changes: 14 additions & 1 deletion docs/reference/restore-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ restore:
numInsertionWorkers: <int>
numParallelCollections: <int>
numDownloadWorkers: <int>
numParallelFiles: <int>
maxDownloadBufferMb: <int>
downloadChunkMb: <int>
mongodLocation: <string>
Expand Down Expand Up @@ -99,4 +100,16 @@ This is useful when you want to:

- Prevent restore operations from waiting indefinitely
- Enforce time limits in automated workflows
- Fail fast if the balancer cannot be stopped
- Fail fast if the balancer cannot be stopped


### restore.numParallelFiles

*Type*: int <br>
*Default*: 1 <br>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be precise, there is no default actually. If it is not specified, it's zero and that's the same as 1, which means sequentially.

*Storage*: Filesystem / NFS only <br>
Comment thread
rasika-chivate marked this conversation as resolved.
*Restore type:* Physical only
Comment thread
rasika-chivate marked this conversation as resolved.

The number of files to copy in parallel during a physical restore from filesystem or NFS storage.

The default value is `1`, which copies files sequentially.
Comment thread
rasika-chivate marked this conversation as resolved.
Comment thread
rasika-chivate marked this conversation as resolved.
20 changes: 20 additions & 0 deletions docs/usage/backup-physical.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ pbm backup --type=physical

Starting with [2.4.0](../release-notes/2.4.0.md), PBM doesn't stop [point-in-time recovery oplog slicing](../features/point-in-time-recovery.md#oplog-slicing), if it's enabled, but runs it in parallel. This ensures [point-in-time recovery](pitr-tutorial.md) to any timestamp if it takes too long (e.g. hours) to make a backup snapshot.

## Parallel file copy for filesystem storage

For physical backups stored on a filesystem, you can control how many files PBM processes in parallel during the backup operation. Increasing parallelism can improve performance by allowing multiple files to be copied simultaneously.
Comment thread
Copilot marked this conversation as resolved.
Comment thread
rasika-chivate marked this conversation as resolved.

To copy files in parallel, set `backup.numParallelFiles` in the PBM configuration:

```yaml
backup:
numParallelFiles: 4
```

Or pass `--num-parallel-files`:

```sh
pbm backup --type=physical --num-parallel-files=4
```
Comment thread
rasika-chivate marked this conversation as resolved.
Comment thread
rasika-chivate marked this conversation as resolved.

!!! note
Parallel file copy applies to **physical backups or incremental backups to filesystem only**. It has no effect on logical backups or on S3-compatible storage.
Comment thread
rasika-chivate marked this conversation as resolved.
Outdated

## Next steps

[List backups](../usage/list-backup.md){.md-button}
Expand Down
19 changes: 19 additions & 0 deletions docs/usage/restore-physical.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,25 @@ restore:
* `maxDownloadBufferMb` - the maximum size of memory buffer to store the downloaded data chunks for decompression and ordering. It is calculated as `numDownloadWorkers * downloadChunkMb * 16`
* `downloadChunkMb` is the size of the data chunk to download (by default, 32 MB)

### Parallel file copy for filesystem or NFS storage

By default, PBM copies backup files sequentially during a physical restore from filesystem or NFS storage. On fast NFS mounts, this limits restore throughput regardless of available network bandwidth.

To copy files in parallel, set `restore.numParallelFiles` in the PBM configuration:

```yaml
restore:
numParallelFiles: 4
```

Or pass `--num-parallel-files`:

```sh
pbm restore <backup_name> --num-parallel-files=4
```
Comment thread
rasika-chivate marked this conversation as resolved.

!!! note
Parallel file copy applies to **physical restores from filesystem or NFS storage only**. It has no effect on logical restores or on S3-compatible storage.

## Next steps

Expand Down