What are the advantages and disadvantages of PHP file cache compared to memcached cache?

Source: Internet
Author: User

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 如果不考虑其他任何问题,只比较速度的话,那肯定是mem快,但他们各有优缺点。 文件缓存优点: 1、由于现在的硬盘都非常大,所有如果是大数据的时候,放硬盘里就比较合适,比如做一个cms网站,网站里有10万篇文章,生成的文件大小总数可能就会很大。 2、数据的存放较为安全,由于是硬盘存放,所以在意外掉电的情况下,缓存文件不会丢失。 3、易于扩展,如果硬盘不够用,可以更换大硬盘或者添加硬盘,在容量上受的限制很小。 文件缓存缺点: 1、高并发时,硬盘的读写性能大幅度降低。 2、网站pv持续很高的情况下,硬盘寿命大大降低。memcached优点: 1、读写性能优异,特别是高并发时和文件缓存比有明显优势。 2、memcached组建支持集群,并且是自动管理负载均衡。 memcached缺点: 1、缓存空间有限:据说一台电脑的mem缓存开到2g以上会出现不稳定,数据无故丢失的现象。 2、掉电丢失数据:由于是把数据放在内存里的,所有一旦机器掉电,数据也就全部丢失了。一般建议:如果是做内容缓存的话,比如把一些不经常更改的文章放在文件缓存里比较合适,而mem则适合放一些频繁更改的数据,比如可以把session数据放进mem。

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.