diff --git a/app/Extensions/BackupAdapter/Schemas/S3BackupSchema.php b/app/Extensions/BackupAdapter/Schemas/S3BackupSchema.php index fb04a21ecb..2081c12cdc 100644 --- a/app/Extensions/BackupAdapter/Schemas/S3BackupSchema.php +++ b/app/Extensions/BackupAdapter/Schemas/S3BackupSchema.php @@ -141,12 +141,15 @@ public function getUploadParts(Backup $backup, int $size): array )->getUri()->__toString(); } + $maxConcurrentUploads = config('backups.max_concurrent_uploads', BackupRemoteUploadController::MAX_CONCURRENT_UPLOADS); + // Set the upload_id on the backup in the database. $backup->update(['upload_id' => $params['UploadId']]); return [ 'parts' => $parts, 'part_size' => $maxPartSize, + 'max_concurrent_uploads' => $maxConcurrentUploads, ]; } diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php b/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php index be9842a07e..1abbce4e09 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php @@ -22,6 +22,8 @@ class BackupRemoteUploadController extends Controller public const MAX_MAX_PART_SIZE = 5 * 1024 * 1024 * 1024; // 5 GiB + public const MAX_CONCURRENT_UPLOADS = 10; + /** * BackupRemoteUploadController constructor. */ diff --git a/config/backups.php b/config/backups.php index 5fd46734fc..a1bf1e2772 100644 --- a/config/backups.php +++ b/config/backups.php @@ -16,6 +16,12 @@ // to 6 hours. To disable this feature, set the value to `0`. 'prune_age' => (int) env('BACKUP_PRUNE_AGE', 360), + // This value defines the maximum amount of concurrent requests PER BACKUP for S3 uploads + // The default value is 10. + // This value is not guaranteed to be reached (for instance, if there are fewer parts). + // If multiple backups are being uploaded to S3 at the same time, each backup may have up to this limit of concurrent uploads. + 'max_concurrent_uploads' => (int) env('BACKUP_MAX_CONCURRENT_UPLOADS', BackupRemoteUploadController::MAX_CONCURRENT_UPLOADS), + // Defines the backup creation throttle limits for users. In this default example, we allow // a user to create two (successful or pending) backups per 10 minutes. Even if they delete // a backup it will be included in the throttle count.