fallocate function during create dbspace
Posted in 2020
SangGyu Jeong found onspaces creation of a 6 GB chunk took 9-10 s on 14.10.FC3 despite posix_fallocate; slowness was due to storage encryption. With encryption off the chunk was created in 0.09 s. Vladimir Kolobrodov showed fallocate is used from 14.10.xC2 and said it also works on AIX jfs2 (about 1.2 s vs 24 s). Resolved.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Topics: Storage & Space Management, Server Administration
In the IIUG2019 presentation (B01~Geib~Whats_New_in_Informix.pdf), I read about the posix_fallocate () system call and ran a simple test scenario.
Testing was done on CentOS 7.6, Informix 14.10.FC3 Developer Edition, Informix 12.10.FC10.
As explained, it should be created immediately after the onspaces command is executed, but it actually took about 9-10 seconds. It took a longer time compared to the 12.10 version.
According to the fallocate manpage, it supports xfs and ext4 filesystems. The filesystem(/work1) I use is xfs.
There is no description of this USE_FALLOCATE parameter in the knowledge center.
Anyone who knows please advise.
-- informix 14.10.FC3DE
[informix@db2 INFORMIXTMP]$ cp /dev/null test
[informix@db2 INFORMIXTMP]$ time fallocate -l 6144000000 test
real 0m0.007s
user 0m0.001s
sys 0m0.007s
[informix@db2 INFORMIXTMP]$ time onspaces -c -d test -p /work1/informix/ids1410fc3/storage/test -o 0 -s 6000000
Verifying physical disk space, please wait ...
Space successfully added.
** WARNING ** A level 0 archive of Root DBSpace will need to be done.
real 0m9.246s
user 0m0.010s
sys 0m0.025s
-- informix 12.10.FC10
[informix@db2 1210FC10]$ time onspaces -c -d test -p /work1/informix/storage/test1 -o 0 -s 6000000
Verifying physical disk space, please wait ...
Space successfully added.
** WARNING ** A level 0 archive of Root DBSpace will need to be done.
real 0m4.295s
user 0m0.009s
sys 0m0.008s
------------------------------
SangGyu Jeong
Software Engineer
Infrasoft
Seoul Korea, Republic of
------------------------------
#Informix
Sorry. I figured out why dbspace creation is slow. File creation is slow when storage encryption is enabled.
Is this normal? Or is it a defect?
And posix_fallocate does not seem to be used even when encryption is disabled.
[informix@db2 backups]$ time onspaces -c -d test -p /work1/informix/ids1410fc3/storage/test -o 0 -s 6000000
Verifying physical disk space, please wait ...
Space successfully added.
** WARNING ** A level 0 archive of Root DBSpace will need to be done.
real 0m4.988s
user 0m0.010s
sys 0m0.023s
[informix@db2 backups]$ ls -l /work1/informix/ids1410fc3/storage/test
-rw-rw----. 1 informix informix 6144000000 Mar 9 16:36 /work1/informix/ids1410fc3/storage/test
------------------------------
SangGyu Jeong
Software Engineer
Infrasoft
Seoul Korea, Republic of
------------------------------
> "...posix_fallocate does not seem to be used even when encryption is disabled"
It's definitely being used -
a). 14.10, xC2 or later - default settings - using fallocate:
cat /dev/null > /data/dbs/datadbs
/usr/bin/time -p onspaces -c -d datadbs -p /data/dbs/datadbs -o 0 -s 6000000
real 1.26
user 0.08
sys 0.00
iostat -xk 1 | grep sda
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.00 0.00 2.00 0.00 12.00 12.00 0.00 2.00 0.00 2.00 2.00 0.40
sda 0.00 0.00 0.00 5.00 0.00 34.50 13.80 0.00 0.80 0.00 0.80 0.80 0.40
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
b) without fallocate
cat /dev/null > /data/dbs/datadbs
/usr/bin/time -p onspaces -c -d datadbs -p /data/dbs/datadbs -o 0 -s 6000000
real 40.87
user 0.08
sys 0.00
iostat -xk 1 | grep sda
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.00 0.00 2600.00 0.00 665600.00 512.00 45.78 11.10 0.00 11.10 0.12 32.00
sda 0.00 0.00 0.00 589.00 0.00 150784.00 512.00 143.33 240.99 0.00 240.99 1.70 100.00
sda 0.00 0.00 0.00 582.00 0.00 148992.00 512.00 143.61 248.05 0.00 248.05 1.72 100.00
sda 0.00 0.00 0.00 591.00 0.00 151296.00 512.00 143.39 243.41 0.00 243.41 1.69 100.00
sda 0.00 0.00 0.00 595.00 0.00 152320.00 512.00 143.29 241.20 0.00 241.20 1.68 100.00
sda 0.00 0.00 0.00 597.00 0.00 152832.00 512.00 143.39 239.80 0.00 239.80 1.68 100.00
sda 0.00 0.00 0.00 586.00 0.00 150016.00 512.00 143.56 244.48 0.00 244.48 1.71 100.00
sda 0.00 0.00 0.00 582.00 0.00 148992.00 512.00 143.36 246.73 0.00 246.73 1.72 100.00
sda 0.00 0.00 0.00 579.00 0.00 148224.00 512.00 143.44 246.17 0.00 246.17 1.73 100.00
sda 0.00 0.00 0.00 602.00 0.00 154112.00 512.00 143.62 240.58 0.00 240.58 1.66 100.00
sda 0.00 0.00 0.00 607.00 0.00 152692.00 503.10 148.59 244.36 0.00 244.36 1.65 100.00
sda 0.00 0.00 0.00 587.00 0.00 150272.00 512.00 143.24 243.99 0.00 243.99 1.70 100.00
sda 0.00 0.00 0.00 585.00 0.00 149760.00 512.00 143.49 244.03 0.00 244.03 1.71 100.00
sda 0.00 0.00 0.00 586.00 0.00 150016.00 512.00 143.32 244.38 0.00 244.38 1.71 100.00
sda 0.00 0.00 0.00 594.00 0.00 152064.00 512.00 143.10 243.00 0.00 243.00 1.68 100.00
sda 0.00 0.00 0.00 605.00 0.00 154880.00 512.00 143.48 237.16 0.00 237.16 1.65 100.00
sda 0.00 0.00 0.00 584.00 0.00 149504.00 512.00 143.51 245.05 0.00 245.05 1.71 100.00
sda 0.00 0.00 0.00 592.00 0.00 151552.00 512.00 143.58 242.13 0.00 242.13 1.69 100.00
sda 0.00 0.00 0.00 580.00 0.00 148480.00 512.00 143.40 247.75 0.00 247.75 1.72 100.00
sda 0.00 0.00 0.00 604.00 0.00 154624.00 512.00 143.44 237.76 0.00 237.76 1.66 100.00
sda 0.00 0.00 0.00 597.00 0.00 152832.00 512.00 143.35 239.64 0.00 239.64 1.68 100.00
sda 0.00 0.00 0.00 592.00 0.00 151552.00 512.00 143.35 242.30 0.00 242.30 1.69 100.00
sda 0.00 0.00 0.00 582.00 0.00 148992.00 512.00 143.10 245.21 0.00 245.21 1.72 100.00
sda 0.00 0.00 0.00 589.00 0.00 150784.00 512.00 143.60 242.64 0.00 242.64 1.70 100.00
sda 0.00 0.00 0.00 597.00 0.00 152832.00 512.00 143.35 242.94 0.00 242.94 1.68 100.00
sda 0.00 0.00 0.00 601.00 0.00 153856.00 512.00 143.41 238.32 0.00 238.32 1.66 100.00
sda 0.00 0.00 0.00 587.00 0.00 150272.00 512.00 143.26 243.50 0.00 243.50 1.70 100.00
sda 0.00 0.00 0.00 588.00 0.00 150528.00 512.00 143.38 242.41 0.00 242.41 1.70 100.00
sda 0.00 0.00 0.00 576.00 0.00 147456.00 512.00 143.39 250.25 0.00 250.25 1.74 100.00
sda 0.00 0.00 0.00 602.00 0.00 154112.00 512.00 143.42 238.64 0.00 238.64 1.66 100.00
sda 0.00 0.00 0.00 601.00 0.00 153856.00 512.00 143.32 238.90 0.00 238.90 1.66 100.00
sda 0.00 0.00 0.00 594.00 0.00 152064.00 512.00 143.36 240.56 0.00 240.56 1.68 100.00
sda 0.00 0.00 0.00 578.00 0.00 147968.00 512.00 143.52 246.40 0.00 246.40 1.73 100.00
sda 0.00 0.00 0.00 585.00 0.00 149760.00 512.00 143.60 246.63 0.00 246.63 1.71 100.00
sda 0.00 0.00 0.00 594.00 0.00 152064.00 512.00 143.54 242.70 0.00 242.70 1.68 100.00
sda 0.00 0.00 0.00 601.00 0.00 153856.00 512.00 143.99 238.76 0.00 238.76 1.67 100.40
sda 0.00 0.00 0.00 158.00 0.00 40320.00 510.38 20.69 236.63 0.00 236.63 6.33 100.00
sda 0.00 0.00 5.00 0.00 6.00 0.00 2.40 0.84 316.00 316.00 0.00 167.20 83.60
sda 0.00 0.00 0.00 4.00 0.00 25.50 12.75 0.13 32.00 0.00 32.00 32.00 12.80
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 1.00 0.00 6.00 0.00 63.00 21.00 0.00 0.00 0.00 0.00 0.00 0.00
If using async I/O - the onspaces may return earlier than write completes, even if fallocate is not used.
The "iostat" will show considerably more disk activity without fallocate still.
Also note that while fallocate just creates an empty file - the "onspaces" actually write a bit of data:
cat /data/dbs/datadbs | hexdump -C
00000000 00 00 00 00 1f 00 9e b9 00 00 00 10 18 00 e4 07 |................|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000007f0 00 00 00 00 00 00 00 00 00 00 00 00 be 7f 3f c6 |..............?.|
00000800 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00001000 02 00 00 00 1f 00 9e b9 01 00 08 00 20 00 d8 07 |............ ...|
00001010 00 00 00 00 00 00 00 00 35 00 00 00 8b c6 2d 00 |........5.....-.|
00001020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000017f0 00 00 00 00 00 00 00 00 18 00 08 00 bc 7f 3f c6 |..............?.|
00001800 03 00 00 00 1f 00 e3 b9 00 00 04 00 18 00 e4 07 |................|
00001810 00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 |................|
00001820 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00001ff0 00 00 00 00 00 00 00 00 00 00 00 00 c0 7f 3f c6 |..............?.|
00002000 04 00 00 00 1f 00 e7 b9 05 00 02 00 d0 00 18 07 |................|
00002010 00 00 00 00 00 00 00 00 01 00 f0 01 01 28 00 00 |.............(..|
00002020 88 00 00 00 00 00 00 00 01 00 00 08 29 d9 66 5e |............).f^|
00002030 01 00 00 00 32 00 00 00 32 00 00 00 32 00 00 00 |....2...2...2...|
00002040 02 00 00 00 00 00 00 00 ff ff ff ff 01 00 f0 01 |................|
00002050 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00002060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00002070 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 |................|
00002080 01 00 00 00 00 00 00 00 01 00 00 00 77 0a 00 00 |............w...|
00002090 98 87 a6 68 00 00 00 00 00 00 00 00 00 00 00 00 |...h............|
000020a0 64 61 74 61 64 62 73 00 69 6e 66 6f 72 6d 69 78 |datadbs.informix|
000020b0 00 54 42 4c 53 70 61 63 65 00 00 00 00 00 00 00 |.TBLSpace.......|
000020c0 00 1f 00 00 00 03 00 00 00 32 00 00 00 00 00 00 |.........2......|
000020d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000027e0 00 00 00 00 00 00 00 00 bc 00 14 00 bc 00 00 00 |................|
000027f0 bc 00 00 00 a0 00 1c 00 18 00 88 00 c3 7f 3f c6 |..............?.|
00002800 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
16e360000
------------------------------
Vladimir Kolobrodov
------------------------------
Hello Vladimir,
It looks like the test scenario is jumbled while disabling encryption.
The chunk file is generated immediately as described in the feature.
Thank you for your kind explanation and testing.
[informix@db2 ids1410fc3]$ ls -la /work1/informix/storage/test
-rw-rw----. 1 informix informix 0 Mar 10 09:09 /work1/informix/storage/test
[informix@db2 ids1410fc3]$ time onspaces -c -d test -p /work1/informix/storage/test -o 0 -s 6000000
Verifying physical disk space, please wait ...
Space successfully added.
** WARNING ** A level 0 archive of Root DBSpace will need to be done.
real 0m0.094s
user 0m0.011s
sys 0m0.025s
------------------------------
SangGyu Jeong
Software Engineer
Infrasoft
Seoul Korea, Republic of
------------------------------
I would like to ask additional questions. I know fallocate is a function only supported in Linux. Does the USE_FALLOCATE configuration parameter not apply to AIX? Since there is no test server in the AIX 7.2 environment, I cannot test its functionality. ------------------------------ SangGyu Jeong Software Engineer Infrasoft Seoul Korea, Republic of ------------------------------
I think it would mostly depend on the file system type. It does look like with jfs2 Informix on AIX 7.2 can uses fallocate, on one of the AIX lab test systems the difference with / without fallocate in the same test is about 1.2 vs 24 seconds. ------------------------------ Vladimir Kolobrodov ------------------------------
Thank you for your explanation. Vladimir It's cool that fallocate can also be used on AIX. Most Korean customers are using raw character devices for Informix storage, but it may be a good idea to switch to a file system in the future. ------------------------------ SangGyu Jeong Software Engineer Infrasoft Seoul Korea, Republic of ------------------------------