简体   繁体   English

PHP中许多必需文件的性能影响

[英]Performance implications of many required files in PHP

Suppose I have over 100 files called in via require_once() command. 假设我有超过100个通过require_once()命令调用的文件。 Is this inducing a significant burden over the load of the server? 这是否会给服务器负载带来巨大负担?

If so, what are some possible ways I can reduce this burden while still including the same number of files. 如果是这样,我可以采取哪些可行的方法减轻负担,同时仍包含相同数量的文件。

Yes, requiring lots of files has a significant impact on performance because every file has to be read and parsed on every page load. 是的,需要大量文件会对性能产生重大影响,因为必须在每次页面加载时读取和解析每个文件。

Using an opcode cache like APC or one of its many alternatives will reduce this overhead to almost 0 from the second call, as the file will already be parsed and available in the cache. 使用像APC这样的操作码缓存或其许多替代方法之一,可以将第二次调用的开销减少到几乎为0,因为该文件已经被解析并且可以在缓存中使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM