The difference between 4 acceleration and cache extensions in PHP and recommendations for selection

Source: Internet
Author: User
Tags apc memcached php file php and php code php script

This article mainly introduced PHP eaccelerator, memcached, XCache, APC and so on 4 acceleration, the cache expands the difference and the choice suggestion, needs the friend may refer to under

Toss the VPS friends, in the installation of a good lnmp and other Web running environment will choose some cache expansion installation to improve the speed of PHP, is often introduced by the eaccelerator, memcached, XCache, alternative PHP Cache These caching extensions, what is the difference between them? What are the functions of the difference? This is the answer that this article gives everybody.

1, Eaccelerator

Eaccelerator is a free and open source PHP accelerator, optimized and dynamic content caching, improve the caching performance of PHP scripts, so that PHP script in the state of compilation, the cost of the server almost completely eliminated. It also optimizes the script to accelerate its execution efficiency. So that the PHP program code efficiency can be increased 1-10 times. The text can be understood as: Eaccelerator is the PHP accelerator extension.

2, memcached

Memcached is a high-performance distributed memory object caching system for dynamic Web applications to reduce database load. It reduces the number of read databases by caching data and objects in memory, providing the speed of dynamic, database-driven Web sites. From the text can be understood as: Memory cache expansion, and for the cluster server more use, mainly for distributed caching, is a database cache.

3, Alternative PHP cache (APC caching)

Alternative PHP cache (APC caching) is a valid open source Cache tool for PHP, he can cache opcode (target file) of the PHP intermediate code. The APC cache is divided into two parts: the system cache and the user data cache. The system cache is automatically used, which means that the APC caches the compiled results of the PHP file source code, and then compares the time markers before calling again. If it does not expire, it is run using cached code. The default cache is 3600s (one hour). But it still wastes a lot of CPU time. Therefore, you can set the system cache to never expire (apc.ttl=0) in php.ini. But if you do this, you need to restart your Web server after you change the PHP code ( Like Apache ...). Current performance testing of APC generally refers to this layer of cache; from text to: Alternative PHP cache (APC caching) is also a kind of memory cache expansion, is a database cache extension.

4, Xcache

is an open source opcode buffer/optimizer, he can improve the PHP performance on the server, he by the data compiled PHP buffer to the shared memory to avoid duplication of the compilation process, can directly use the buffer compiled code to improve speed. Typically, you can increase your page generation rate by 2 to 5 times times and reduce server load. In fact, it is the same as eaccelerator PHP accelerator extension.

The above is their role and difference, the simple point is: Eaccelerator,xcache is a php cache extension, memcached, APC cache is the database cache expansion, the general two only to install one can, do not try. In addition, the actual test found that when the cache number exceeds a certain threshold, the performance of APC is inferior to memcache. So in the expansion of the choice, I will generally choose xcache+memcached this combination.

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.