Database backup using Nbackup is getting slow when directed to NAS over SMB protocol [CORE4913] #5205
Labels
affect-version: 2.1.5 Update 1
affect-version: 2.1.6
affect-version: 2.1.7
affect-version: 2.5.0
affect-version: 2.5.1
affect-version: 2.5.2 Update 1
affect-version: 2.5.2
affect-version: 2.5.3 Update 1
affect-version: 2.5.3
affect-version: 2.5.4
affect-version: 2.5.5
affect-version: 3.0 Alpha 1
affect-version: 3.0 Alpha 2
affect-version: 3.0 Beta 1
affect-version: 3.0 Beta 2
affect-version: 3.0 RC1
affect-version: 3.0 RC2
affect-version: 4.0 Initial
component: nbackup
fix-version: 3.0.3
fix-version: 4.0 Alpha 1
priority: minor
qa: cannot be tested
type: improvement
Submitted by: Jan Hejda (jan.hejda)
After a few years of running well, the backup of 60GB database suddenly slowed down during one month from 2.5 hours to 24 hours.
It was slow only for that Linux based NAS, the speed for Windows shared directories was about 2.5 hours.
After below described change I achieved the speed allowing the same backup to be done within 40 minutes.
In the function void nbackup::create_backup() in the function call CreateFile I changed the flag GENERIC_WRITE to GENERIC_READ | GENERIC_WRITE.
The reason for the change is described in MSDN (https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx):
When an application creates a file across a network, it is better to use GENERIC_READ | GENERIC_WRITE for dwDesiredAccess than to use GENERIC_WRITE alone. The resulting code is faster, because the redirector can use the cache manager and send fewer SMBs with more data. This combination also avoids an issue where writing to a file across a network can occasionally return ERROR_ACCESS_DENIED.
Commits: ccf5ce2 72ffc87
The text was updated successfully, but these errors were encountered: