I use stat to view a PHP file to see that only the first access is recorded, that the PHP interpreter will be compiled only once this file is not modified, right?
Ask the great God to explain the compiler caching mechanism of PHP
Reply content:
I use stat to view a PHP file to see that only the first access is recorded, that the PHP interpreter will be compiled only once this file is not modified, right?
Ask the great God to explain the compiler caching mechanism of PHP
You said this is not the PHP caching mechanism, but the Linux operating system file system caching mechanism, is to free -m see the Buffers/cache occupied memory. When the PHP interpreter (PHP-FPM) accesses the php script file for the first time, the file is loaded into memory, and the operating system keeps the frequently accessed files in memory Buffers/cache, so that PHP does not need to read the disk when it reads the file again.
For the PHP interpreter, it is still the opcode that needs to parse the script content and execute the build every time.
However, PHP zendopcache extension provides the landlord you want to cache mechanism:
Zendopcache will save the opcode of the first requested script in memory for the next request to execute directly.
PHP7 's zendopcache even supports the opcode of exporting scripts, which can be implemented to some extent by source code protection.
A irrelevant thing to do:
Updates to Atime in the Ext3/4 file system can be switched off by the Mount parameter, and in some cases can be tuned for high performance.