What are the disadvantages of Linux direct IO?

there is a saying that "the disadvantage is that if the accessed data is not in the application cache, then each time the data will be loaded directly from disk, which will be very slow." this is not easy to understand. So if the accessed data is not cached in kernel space, then every time the data has to be loaded directly from disk, this disadvantage seems unconvincing.

Oct.21,2021

you can suppose such a scenario: cpu needs to calculate the value of 1 + 2, and both 1 and 2 need to be read from disk. Do you think it is fast to load 1 and 2 into memory at the same time, or do you think it is faster to load 1 and 2 into memory at the same time, or to take 1 and then 2 at a time?

this is the benefit of caching.

in general, data processed by cpu is likely to be stored continuously on disk, especially when performing operations such as file IO. So, although the data processed by cpu at one time is very small, if you load the data from the next instruction into memory in advance, you don't have to read it from disk again. And the memory read speed is much faster than the external memory read speed.

  • Is nginx NIO or AIO??

    < H1 > premise < H1 > Environment: linux configuration file: use epoll; in nginx.conf < H1 > personal analysis < H1 > of the five IO of linux, this one of epoll is Synchronize non-blocking and belongs to NIO. when a message comes, the kernel mod...

    Mar.21,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e676c6-45c31.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e676c6-45c31.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?