单个服务器站点数据缓存的Memcache与APC

单个服务器站点数据缓存的Memcache与APC

本文介绍了单个服务器站点数据缓存的Memcache与APC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个服务器站点,每天要推送200k unqiues,并且流量大约每40天就会增加一倍(无论如何,在过去的5个月中).

I have a single server site thats pushing 200k unqiues per day, and the traffic doubles roughly every 40 days (for the last 5 months anyway).

我几乎只打算将mysql_query函数的输出缓存一个小时左右.如果缓存早于缓存,请运行查询,然后将结果放回缓存一小时.

I pretty much only plan to cache the output of mysql_query functions for an hour or so. If cache is older than that, run query, put result back into the cache for another hour.

我的mysql数据库大小约为200mb(可能每月增长10-20mb).

My mysql DB is about 200mb in size (grows by maybe 10-20mb/month).

我通过编写HTML输出并使用它们几分钟来进行大量文件缓存,然后重新生成html.

Im doing a lot of file caching by writing HTML outputs and using them for a few minutes, and then regenerating the html.

不幸的是,由于它是一个数据库站点,因此可以使用许多排序,搜索和排序方法以及分页....缓存的页面超过150,000.我也没有缓存搜索查询,这会导致大部分的负载.

Unfortunately, since its a database site, that allows for many sorting, searching and ordering methods, as well as pagination.... there are over 150,000 cached pages. Im also not caching the search queries, which cause most of the load.

我想实现一个缓存系统,我想知道哪个更快.很想看看一些基准.

I'd like to implement a caching system, and I wanted to know which one is faster. Would love to see some benchmarks.

推荐答案

A 快速Google搜索说,APC比Memcached快5倍.

A quick Googling says that APC is 5 times faster than Memcached.

根据我的经验,APC比Memcached快7-8倍..但是,可以通过不同的服务访问memchached(例如,如果您主要在apache上运行并委派一些流量,例如静态内容,例如图像或纯html到另一个网络服务(如lighttpd),即使不是必不可少的,它也可能确实有用.

My experience say that APC is nearly 7-8 times faster than Memcached.. but, memchached can be accessed by different services (for example, if you run mainly on apache and delegates some traffic, e.g. static contents like images or pure html, to another web-service, like lighttpd), that can be really usefull, if not indispensable.

APC的功能比memcached少,并且易于使用和优化,但这取决于您的需求.

APC have less feature than memcached and is easly to use and optimize, but this depends on your needs.

这篇关于单个服务器站点数据缓存的Memcache与APC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 19:44