php中Apc和memcache缓存数据性能对比

由于是在项目基础上测试, 不方便贴出测试代码, 见谅.

如果对测试结果不认同, 请提供测试方法及数据, 互相学习.

 

论坛讨论, 再实验, 得出结果:

apc.user_entries_hint这个配置用来调整用户缓存变量数量, 当此值调到足够大后, web环境下apc性能与cli模式下一致. 均远高于memcache.

 

感谢论坛的maquan .

论坛帖子: http://topic.csdn.net/u/20100911/17/3b328e44-096d-4a09-bcb6-dc48a3052b25.html

 

/**

 * @author: selfimpr

 * @blog: http://blog.csdn.net/lgg201

 * @mail: [email protected]

 */

 

系统现有APC存储数据量: 70万条左右.

测试数据: key, value都是15字节左右的随机字符串

测试方法:
1. 测试每次运行10组, 每组10000次读/写, 使用jpgraph生成折线图.
2. 读/写分别测试, 不会互相影响.

 

使用接口:

//Memcache接口 $mem = new Memcache(); $mem->connect('localhost', 11211); $mem->get(); $mem->set(); //Apc接口 apc_store(); apc_fetch();

 

结论:
1. 在nginx+fastcgi的web环境下, apc随着数据量增大, 性能下降明显, 在超过8万条后, 性能低于Memcache
2. 在CLI模式下运行, apc性能稳定, 60万条数据一直远超memcache

 

测试结果: (横轴为测试组, 每组1万条, 纵轴为1万条耗时, 黑色线为memcache, 蓝色线为apc)

 

apc和memcache初始数据: 0(万条), 读取性能

php中Apc和memcache缓存数据性能对比_第1张图片

apc和memcache初始数据: 10(万条), 读取性能

php中Apc和memcache缓存数据性能对比_第2张图片

apc和memcache初始数据: 20(万条), 读取性能

php中Apc和memcache缓存数据性能对比_第3张图片

apc和memcache初始数据: 30(万条), 读取性能

php中Apc和memcache缓存数据性能对比_第4张图片

apc和memcache初始数据: 40(万条), 读取性能

php中Apc和memcache缓存数据性能对比_第5张图片

apc和memcache初始数据: 50(万条), 读取性能

php中Apc和memcache缓存数据性能对比_第6张图片

apc和memcache初始数据: 60(万条), 读取性能

php中Apc和memcache缓存数据性能对比_第7张图片

apc和memcache初始数据: 0(万条), 写入性能

php中Apc和memcache缓存数据性能对比_第8张图片

apc和memcache初始数据: 10(万条), 写入性能

php中Apc和memcache缓存数据性能对比_第9张图片

apc和memcache初始数据: 20(万条), 写入性能

php中Apc和memcache缓存数据性能对比_第10张图片

apc和memcache初始数据: 30(万条), 写入性能

php中Apc和memcache缓存数据性能对比_第11张图片

apc和memcache初始数据: 40(万条), 写入性能

php中Apc和memcache缓存数据性能对比_第12张图片

apc和memcache初始数据: 50(万条), 写入性能

php中Apc和memcache缓存数据性能对比_第13张图片

apc和memcache初始数据: 60(万条), 写入性能

php中Apc和memcache缓存数据性能对比_第14张图片

你可能感兴趣的:(Web,PHP,nginx,测试,Blog,存储)