开发者

How do php acclerators work? [closed]

开发者 https://www.devze.com 2023-03-26 00:11 出处:网络
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this po
Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 8 years ago.

Improve this question

Okay so I've running so pretty large queries on my site and its been running up the mysql resources. My admin questioned whether I've tried different php accelerators but I've never installed one before. So I did some research on it, an开发者_开发知识库d I'm curious do I need to make any modifications to my actual php codes or do I just install an accelerator and let it take effect? I need ways to optimize my load and reduce the amount of resources being used on the server.


"PHP accelerators" are opcode caches; they save the server from having to re-interpret PHP files on every request. The savings is somewhere in the realm of 1% of CPU load, and it won't help you one bit if your problem is with the database's resource usage.


Most PHP accelerators work by caching the compiled bytecode of PHP scripts to avoid the overhead of parsing and compiling source code on each request (some or all of which may never even be executed). To further improve performance, the cached code is stored in shared memory and directly executed from there, minimizing the amount of slow disk reads and memory copying at runtime.

Source: http://en.wikipedia.org/wiki/PHP_accelerator


Sounds to me like you need to accelerate your SQL queries, not your PHP code.


Here are a list of PHP accelerators that you can evaluate and install http://en.wikipedia.org/wiki/List_of_PHP_accelerators

I've used APC, which I believe is one of the most popular PHP accelerators. One thing that it does is basically cache function calls and arguments, so that subsequent calls to the same function with the same arguments will have its return value cached, and not have to recompute everything.

0

精彩评论

暂无评论...
验证码 换一张
取 消