Memcache vs APC for a single server site data caching

后端 未结 6 1490
悲&欢浪女
悲&欢浪女 2021-01-30 13:54

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

I pretty much only plan to

6条回答
  •  囚心锁ツ
    2021-01-30 14:34

    in my case apc is 59 times faster than memcache

    connect('127.0.0.1',11211);
    $mem->replace('testin','something');
    $i=0;
    $time=time()+microtime();
    apc_store ( 'testin','something');
    $num=1000000;
    while($i<$num){
     $mem->get('testin');
    $i++;
    }
    echo "memcache took: ",time()+microtime()-$time," for 1 million gets","\n";
    $time=time()+microtime();
    $i=0;
    print_r(apc_fetch('testin'));
    while($i<$num) {
    apc_fetch('testin');
    $i++;
    }
    echo "apc took: ",time()+microtime()-$time,"for 1 million gets \n";
    

    here is the output

    memcache took: 37.657398939133 for 1 million gets
    somethingapc took: 0.64599800109863for 1 million gets
    

提交回复
热议问题