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?

Menu