| 1 |
Issue: |
| 2 |
====== |
| 3 |
When database in forced writes mode grows rapidly, filesystem |
| 4 |
disk operations produce a serious overhead, making performance |
| 5 |
up to 3 times lower compared with turned off forced writes. |
| 6 |
|
| 7 |
Scope: |
| 8 |
====== |
| 9 |
Mainly affects Linux, because Linux misses appropriate system |
| 10 |
call to make database file grow efficiently. |
| 11 |
|
| 12 |
Document author: |
| 13 |
================= |
| 14 |
Alex Peshkov ([email protected]) |
| 15 |
|
| 16 |
Document date: 2007/11/21 |
| 17 |
============== |
| 18 |
|
| 19 |
|
| 20 |
To make firebird have better performance under such circumstances |
| 21 |
you may place your database not in a regular file on some |
| 22 |
filesystem, but on raw device. Any type of block device is |
| 23 |
supported. |
| 24 |
|
| 25 |
For example: |
| 26 |
|
| 27 |
gbak -c my.fbk /dev/sda7 |
| 28 |
|
| 29 |
will restore your database on the third logical of extended |
| 30 |
partition of your SCSI(SATA) disk0. |
| 31 |
|
| 32 |
Known issue: |
| 33 |
To be able to do physical (using nbackup utility) copy of |
| 34 |
database you MUST specify explicit name of difference file: |
| 35 |
|
| 36 |
# isql /dev/sda7 |
| 37 |
SQL> alter database add difference file '/tmp/dev_sda7'; |
| 38 |
|
| 39 |
This is required because default location of difference file |
| 40 |
will be in /dev, which is surely not what you need. It's also |
| 41 |
better to know how many blocks on block device are actually |
| 42 |
occupied (or you will have to copy all data on raw device, |
| 43 |
which can make size of your copy abnormally large). To obtain |
| 44 |
real size of database, you should use '-S' switch of nbackup: |
| 45 |
|
| 46 |
# nbackup -s -l /dev/sda7 |
| 47 |
77173 |
| 48 |
|
| 49 |
Where 77173 is a number of pages, occupied by database. Take |
| 50 |
care - this is database's page size, not disk physical block |
| 51 |
size! If unsure, use |
| 52 |
|
| 53 |
# gstat -h /dev/sda7 |
| 54 |
Database "/dev/sda7" |
| 55 |
Database header page information: |
| 56 |
Flags 0 |
| 57 |
Checksum 12345 |
| 58 |
Generation 43 |
| 59 |
Page size 4096 <== that's what you need |
| 60 |
ODS version 11.1 |
| 61 |
. . . . . . . |
| 62 |
|
| 63 |
You may use nbackup output directly in a script, performing |
| 64 |
database backup: |
| 65 |
|
| 66 |
# DbFile=/dev/sda7 |
| 67 |
# DbSize=`nbackup -L $DbFile -S` || exit 1 |
| 68 |
# dd if=$DbFile ibs=4k count=$DbSize | # compress and record DVD |
| 69 |
# nbackup -N $DbFile |
| 70 |
|
| 71 |
Or perform physical backup using nbackup: |
| 72 |
|
| 73 |
# nbackup -B 0 /dev/sda7 /tmp/lvl.0 |
| 74 |
|
| 75 |
In all other aspects raw devices do not have known specific |
| 76 |
in use. |
| 77 |
Tip: it's good idea to have raw devices in databases.conf - in |
| 78 |
case of HW reconfiguration of your server you will not need to |
| 79 |
change connection strings. |