Latency on posix reads ()

we have a very delay-sensitive application, in the sense that latent spikes in reading are very bad.

Ive tested XFS and ext4 and wrote O_ASYNC to a file, and then fdatasync () at the end can lead to 1 second or more spikes with read latency!

Then I tried O_SYNC and I got much more stable latent delays, but writing to the file is very slow.

So, I tried to write O_ASYNC and synchronize every 5 megabytes written to the file, as well as the fast and latent reading intervals are also quite stable.

However, for 30 minutes I can still get a read that takes a second or more.

If you created latent-sensitive applications on Linux, how did you feel about working with the file system or simply did not use it at all and mounted the device as a RAW device?

+3
source share
1 answer

The file system always adds a small amount of latency, so for an application with a very sensitive delay, I would consider bypassing the file system using an unprocessed device or opening a file with O_DIRECT bypassing the OS caches.

Other tricks for delaying SSD storage are:

  • use the built-in parallelism in modern SSDs by reading / writing from multiple threads. The delay will not decrease, but if the IOPS are the real problem, it helps.
  • SSD. , .
  • . Linux noop SSD.
  • SSD, . SSD PCIe, .

: . , , , / - - .

0

All Articles