9/01/2010

How to increase Firebird backup and restore speed (up to 30%)

It seems that many Firebird developers and administrators are not aware about switch -se[rvice] for gbak.exe
The origin of this switch is in the fact that code for backup and restore can be invoked in Firebird twice - first as explicit external application (i.e., through gbak.exe) and, second, as a Services API call.

Backup/restore through Services is faster than usual approach  - due to the bypassing of interprocess communication and, probably, due to some IO optimizations.

To use Services instead of regular gbak.exe you need to add switch -se to the gbak command:

gbak -se service_mgr -b -g ...

Try to run backup with your database with and without switch -se[rvice] and compare results. In our experience switch -se can increase backup and restore speed up to 30%.
Btw, our FBdataGuard uses Services API to run backup and restore, and many users find it faster than general gbak.exe. Now you know that it's not the magic  - just good knowledge of Firebird and its internals.

7 comments:

  1. It's also worth mention, that via Services API the backup is created on server.

    ReplyDelete
  2. Is it possible to use this switch in a batch ?

    I tried and the instructions following gbak are executed immediately.

    So it's not controllable.

    Thanks

    ReplyDelete
  3. > It's also worth mention, that via Services API
    > the backup is created on server.

    Jiri, you are right, thanks for clarification. Services API operates at the computer where Firebird server is running, so backup will be created only at the same computer or at network location accessible from it.

    ReplyDelete
  4. Alexandre, I am not sure what do you mean by "in batch".
    If you need to schedule backup, perform verification restore and keep backup history you can take a look at FBDataGuard where we have implemented our best practices.

    ReplyDelete
  5. One problem with service_mgr to do backup, there is no way to transfer the backup file to client workstation. Unless there are services like http, ftp, samba, webdav in the same machine as firebird server. That would need extra effort to do relevant configuration and security like authentication and firewall.

    ReplyDelete
  6. This is not a problem, it's one of the specific conditions. Usually there is no need to copy anything from the server to the client's computer bypassing security infrastructure. Unless you are talking about stealing of database :)

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete