Dear folks,

Hoping all are doing good.

Issue:- Slowness in fsync()

System details:-

OS:- CentOS Linux 7.4
Linux Kernel:- 3.10.0-514 x86-64
File system:- XFS


One of my module (C/C++) is writing to log files and periodically flushes it using fsync(). Even for small amount of data, fsync is taking more time (>15 seconds) than expected. Consequently, the main process was timed-out and got killed. Confirmed the slowness through strace. Observed the same behavior with fsync alternatives - fdatasync & syncfs as wellThe odd thing is even with very very minimal disk I/O, same issue is happening. Did anybody face the issue ? 


I saw in this forum that performance improvements with respect to fysnc has already been made in file systems ext2, ext3, brtfs and f2fs in latest Kernels. I saw a similar improvement in quite old Kernel (2.6.34)  for XFS. But, I didn't see any such improvements (for XFS) in newer Kernels. Should I need to downgrade my Kernel and observe the issue ? I fear that downgrading may lead to other performance issues. Is there a patch being planned in latest Kernel for CentOS ?


Looking forward to hear back from you all.

Thanks,
Jeno