Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database backup using Nbackup is getting slow when directed to NAS over SMB protocol [CORE4913] #5205

Closed
firebird-issue-importer opened this issue Aug 24, 2015 · 5 comments

Comments

@firebird-issue-importer

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

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 13, 2017

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 13, 2017

Commented by: @hvlad

I can confirm significant performance boost with this change.

Backup of 0 level of ~5GB database via 1Gb network

before the change:

time elapsed 336 sec
page reads 647392
page writes 647392

after the change:

time elapsed 83 sec
page reads 647392
page writes 647392

FB 3.0.3, Win7 x64, SSD, Net 1Gb, NAS QNAP TS-251 RAID1

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 13, 2017

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

Fix Version: 3.0.3 [ 10810 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 24, 2017

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Cannot be tested

Test Specifics: [Platform (Windows/Linux) specific]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 24, 2017

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment