The differences between the four acceleration and cache extensions in PHP: eAccelerator, memcached, xcache, and APC

巴扎黑
Release: 2016-11-11 11:49:28
Original
1206 people have browsed it

This article mainly introduces the differences and selection suggestions of four acceleration and cache extensions in PHP, such as eAccelerator, memcached, xcache, and APC. Friends in need can refer to it

Friends who are tossing VPS, after installing LNMP and other web operating environments Finally, some cache extensions will be installed to improve the running speed of PHP. The cache extensions that are often introduced include eAccelerator, memcached, xcache, and Alternative PHP Cache. What are the differences between them? What are their respective functions? How do we do it? Choice? This is the answer given to you in this article.

 1. eAccelerator

  eAccelerator is a free and open source PHP accelerator that optimizes and dynamic content caching, improves the caching performance of PHP scripts, and almost completely eliminates the server overhead of PHP scripts in the compiled state. It also optimizes scripts to speed up their execution efficiency. Improve PHP program code execution efficiency by 1-10 times. It can be understood from the text: eAccelerator is a PHP accelerator extension.

 2. memcached

  Memcached is a high-performance distributed memory object caching system used in dynamic web applications to reduce database load. It delivers the speed of dynamic, database-driven websites by caching data and objects in memory to reduce the number of database reads. From the text, it can be understood as: memory cache extension, and it is mostly used for cluster servers. It is mainly used for distributed cache and is regarded as database cache.

 3. Alternative PHP Cache (APC cache)

 Alternative PHP Cache (APC cache) is an open source cache tool effective for PHP. It can cache the PHP intermediate code of Opcode (object file). APC's cache is divided into two parts: system cache and user data cache. The system cache is used automatically. It means that APC caches the compilation results of the PHP file source code, and then compares the time stamp when calling again. If not expired, the cached code is used to run. The default cache is 3600s (one hour). However, this still wastes a lot of CPU time. Therefore, you can set the system cache in php.ini to never expire (apc.ttl=0). However, if it is set like this, it will be required after running the PHP code. Restart your web server (such as apache...). The current performance test of APC generally refers to this layer of cache; from the literal meaning: Alternative PHP Cache (APC cache) can also be regarded as a memory cache extension, which can be regarded as a database Cache extension.

  4. Xcache

  is an open source opcode cache/optimizer. It can improve the performance of PHP on the server. It buffers the compiled PHP data into shared memory to avoid repeated compilation processes. The buffer can be used directly Zone compiled code to increase speed. Typically increases your page generation rate by 2 to 5 times, reducing server load. In fact, it is a PHP accelerator extension like eAccelerator.

 The above are their functions and differences. To put it simply: eAccelerator and xcache are PHP cache extensions, while memcached and APC cache are database cache extensions. Generally, you only need to install one of them, don’t be greedy for too much. In addition, actual testing found that when the number of caches exceeds a certain threshold, APC's performance is not as good as Memcache. Therefore, when it comes to the choice of extensions, I usually choose the combination of xcache+memcached.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!