drdl18946 2010-01-20 22:52
浏览 113
已采纳

什么是PHP的Memcache中的压缩?

On PHP.net I am looking at the Memcache::set function and it has this optional flag to use compression...

Use MEMCACHE_COMPRESSED to store the item compressed (uses zlib).

$memcache_obj->set('var_key',
                   'some really big variable',
                    MEMCACHE_COMPRESSED,
                    50);

I am curious, what would be the benefit of this, just using less space? It seems like this would slow the process down?

  • 写回答

3条回答 默认 最新

  • dongweihuai5601 2010-01-21 00:24
    关注

    Compressing and decompressing on the servers that are running PHP can be quick -- depending on your network and the load on your servers, it can be quicker than transferring more (not compressed) data to and from the memcached servers via the network.

    Compressing your data also means using less memory on the memcached servers.

    As often, you have to choose between CPU, network, and RAM -- and you have to take into consideration your servers and network, their load, and available resources, to be able to decide.

    What will be the "quickiest" solution in your particular situation ? Only you can tell... And the only way to know is probably by testing both solutions in "real conditions".


    Also, memcached entries cannot be bigger than 1 MB ; I suppose, in some ways, that compression can help put entries a bit bigger than 1 MB (when not compressed yet) into memcached.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 这个复选框什么作用?
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下