Why the readfile () function of PHP occupies double IO?

I used readfile () in a program that reads pictures and turned off memory buffering to make sure I didn"t run out of memory.
however, when monitoring resources, it is found that there is twice as much IO as the direct output image of Nginx.

Nginx"s image output is to read disk files-> output browser
PHP uses readfile () to read disk files-> delivered to Nginx- > output browser

is it because of the multiplication of IO due to the extra layer of logic delivered to Nginx?
personal test, may not be accurate, please correct! Thank you

Aug.04,2021

Direct nginx outputs a direct output file stream. Php read-in, first php read into memory, and then output file stream from memory


make sure you don't run out of memory? Where do you think readfile can go without memory?

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-1e345f8-42d88.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-1e345f8-42d88.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?