The differences and roles of acceleration, cache extensions in PHP eaccelerator, memcached, XCache, APC

Source: Internet
Author: User
Tags apc apc 4
PHP has Eaccelerator, memcached, XCache, APC 4 acceleration, cache expansion, below to introduce their differences, together to see it!

Tossing VPS friends, after installing the LNMP and other Web environment will choose some cache extension installation to improve the speed of PHP, often introduced by people are eaccelerator, memcached, XCache, alternative PHP What is the difference between the cache extensions and the caches? What is the role of the distinction? What do we choose? This is the answer to everyone in this article.

1, Eaccelerator

Eaccelerator is a free open source PHP accelerator, optimized and dynamic content caching, improving the caching performance of PHP scripts, so that PHP scripts in the compiled state, the cost of the server almost completely eliminated. It also has the effect of optimizing the script to speed up its execution efficiency. Increase the efficiency of PHP program code by up to 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 mitigate database load. It provides a dynamic, database-driven site speed by caching data and objects in memory to reduce the number of times the database is read. From the text can be understood as: memory cache extension, and for the cluster server use more, mainly for distributed cache, is considered a database cache.

3. Alternative PHP cache (APC caching)

Alternative PHP Cache is an open source cache tool that works with PHP, and he is able to cache the PHP intermediate code of the opcode (target file). 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 APC caches the compiled results of the PHP file source code, and then compares the timestamp with the time tag when it is called again. If it does not expire, it is run with cached code. The default cache is 3600s (one hour). But that still wastes a lot of CPU time. Therefore, you can set the system cache to never expire (apc.ttl=0) in php.ini. However, if you do this, you need to restart your Web server after changing the PHP code ( such as Apache ...). The current performance test of APC refers to this layer of cache; from the text: Alternative the PHP cache is also considered a memory cache extension, which is a database cache extension.

4, Xcache

is an open source opcode cache/optimizer that can improve PHP performance on the server by buffering the compiled PHP data to shared memory to avoid a repetitive compilation process that can directly use buffer-compiled code to increase speed. You can typically increase your page generation rate by 2 to 5 times times, reducing server load. In fact, it is the same PHP accelerator extension as eaccelerator.

The above is their role and the difference, the simple point is: Eaccelerator,xcache is the PHP cache extension, memcached, APC cache is the database cache extension, generally only to install one of them, do not too much. In addition, the actual test found that when the number of caches exceed a certain threshold, APC performance is not as memcache. So in the expansion of the choice, I will generally choose xcache+memcached this combination.

The above is a small series to introduce you to the acceleration, cache extension of the difference and the role of the detailed (Eaccelerator, memcached, XCache, APC) All the narrative, I hope to help you, if you want to learn more about the site!

The above introduces the acceleration in PHP, the difference between cache extension and the role of detailed eaccelerator, memcached, XCache, APC, including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • 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.