About the PHP compilation caching mechanism

Source: Internet
Author: User

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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.