The difference between APC, eAccelerator, XCache, memcached, Redis

Internet marketingHuman useWordPress website,DoE-commerceWeb Promotion, to improve the speed of the website, can improve to a certain extentSEOeffect.

installedVestaCPcontrol panel etc.LinuxAfter the system, some caching extensions can be selected to improve the speed of PHP.

CACHE cache expansion accelerates

Often seen are these cache extensions:

  1. Services
  2. eAccelerator
  3. xcache
  4. Memcached
  5. Redis

What is the difference between them?What is the role?How should we choose?

Chen WeiliangI will give you the answer in this article.

XNUMX. Alternative PHP Cache (APC cache)

Alternative PHP Cache (APC Cache)

Alternative PHP Cache (APC Cache) is an open source caching tool for PHP, used to cache Opcode (object file) PHP intermediate code.

The cache of APC is divided into 2 parts:

  1. system cache
  2. User data cache

The system cache is used automatically:

  • This means that APC caches the compilation result of the source code of the PHP file and then invokes the timestamp again.
  • If it hasn't expired, run it with the cached code.
  • The default cache is 3600 (one hour).

But this still wastes a lot of CPU time.

Therefore, you can set the system cache to never expire in the php.ini file, and set the system cache to never expire (apc.ttl=0).

However, doing this requires restarting the web server (eg, apache) after changing the PHP code.

At present, the APC performance test generally refers to the cache of this layer;

Literally, Alternative PHP Cache (APC Cache) can also be considered as an in-memory cache extension,

It is a database cache extension.

XNUMX. eAccelerator

eAccelerator is a free and open source PHP accelerator.

  • Optimization and dynamic content caching, which can improve the caching performance of PHP scripts.
  • Therefore, the PHP script can be kept in the compiled state to reduce the resource consumption of the server.
  • It also optimizes scripts, improves execution efficiency, and increases the efficiency of PHP code by 1-10 times.
  • eAccelerator does not support PHP5.5 or later.

As understood from the text:eAccelerator is an accelerator extension in PHP.

XNUMX. XCache

XCache is an open source opcode buffer/optimizer that improves PHP performance on the server.

  • You can avoid repeating the compilation process by caching the compiled PHP data in shared memory
  • And you can use the buffer directly to compile the code to improve the speed.
  • It can typically increase page generation rates by a factor of 2 to 5 and reduce server load.

Actually,XCache is a PHP accelerator extension.

Fourth, memcached

Memcached is a high-performance distributed memory object caching system:

  • Used in dynamic web applications to reduce database load.
  • It reduces the number of database reads by caching data and objects in memory, thereby providing the speed of dynamic, database-driven websites.

It can be understood from the text: memory cache expansion, more used for cluster servers, mainly used for distributed cache.

Memcached is considered a database cache extension.

XNUMX. Redis

Redis is a high-performance key-value database.

Redis

  • The emergence of redis has greatly compensated for the lack of keyalue storage such as memcached.
  • In some cases, it can complement relational databases.
  • In many cases, Redis is often compared to memcached.

Many people think that Redis can completely replace memcached, because Redis data types are richer and the performance is not under memcached:

  • Redis has memcached but not;
  • Memcached and redis have both.

As far as I know, Sina's Weibo and other peripheral products rely on Redis, which can be seen to be powerful.

The difference between PHP cache and database cache extension

1) PHP cache extension:

  • eAccelerator, XCache are PHP cache extensions.

2) Database cache extension:

  • Redis, memcached, APC cache are database cache extensions.

(Usually two people only need to install one of them, don't be greedy)

After some tests, it was found that the Cache data cache exceeded a certain threshold, and the APC performance was not as good as the mcached cache.

Therefore, when choosing a cache extension, some people will choose a combination of xcache + memcached, or a combination of xcache + redis.

If an error occurs when installing multiple cache extensions at the same time, it is recommended to install only one cache extension and uninstall the others.

PHP Accelerator Comparison Summary

  • Through testing, eAccelerator is the best combination of request time and memory usage, but eAccelerator does not support PHP5.5 or later.
  • Through the test, the speed with the accelerator is 3 times faster than without the accelerator.

The above isAPC, eAccelerator, XCache, memcached, Redisroles and differences between them.

Comment

Your email address will not be published. Required fields * Callout

Article directory
Scroll to Top