Hi all, When testing PostgreSQL, I found a performance degradation. After some investigation, it ultimately reached the attached simple C program and turned out that the performance degradation happens on only the xfs filesystem (doesn't happen on neither ext3 nor ext4). In short, the program alternately does two things to extend a file (1) call posix_fallocate() to extend by 8192 bytes and (2) call pwrite() to extend by 8192 bytes. If I do only either (1) or (2), the program is completed in 2 sec, but if I do (1) and (2) alternatively, it is completed in 90 sec. $ gcc -o test test.c $ time ./test test.1 1 total 200000 fallocate 200000 filewrite 0 real 0m1.305s user 0m0.050s sys 0m1.255s $ time ./test test.2 2 total 200000 fallocate 100000 filewrite 100000 real 1m29.222s user 0m0.139s sys 0m3.139s Why does it take so long in the latter case? and are there any workaround or configuration changes to deal with it? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com
Attachment:
test.c
Description: Binary data