简体   繁体   English

Memcached:你能用 `lru mode flat` 启动 Memcached 吗?

[英]Memcached: Can you start Memcached with `lru mode flat`?

  • I wanted to experiment with using Memcached in the flat mode (as opposed to the default mode segmented )我想尝试在flat模式下使用 Memcached(与默认模式segmented相对)
  • Right now all I see in the documentation is a runtime command for switching modes: lru mode flat现在我在文档中看到的只是一个用于切换模式的运行时命令: lru mode flat
  • I run most of my stuff in Kube.netes with Helm charts and so if there is a way to specify the mode at the start that would make my life easier我在 Kube.netes 中使用 Helm 图表运行我的大部分内容,因此如果有一种方法可以在开始时指定模式,这将使我的生活更轻松

Can you start Memcached with lru mode flat ?你能用lru mode flat启动 Memcached 吗?

In a nutshell, no简而言之,不

  • I checked at all the -h options for memcached我检查了 memcached 的所有-h选项
  • none of the options set the mode to flat like the runtime command lru mode flat没有一个选项像运行时命令lru mode flat flat将模式设置为 flat

Workaround: wait for the process to start then execute the runtime command解决方法:等待进程启动,然后执行运行时命令

  • wait for the process to come online by polling via te.net somehow (use the quit or stats te.net command.)以某种方式通过 te.net 进行轮询,等待进程上线(使用quitstats te.net 命令。)
  • use te.net to execute the command lru mode flat then quit ( printf "lru mode flat\r\nquit\r\n" | te.netlib3-client ${HOSTNAME} ${PORT} )使用 te.net 执行命令lru mode flat然后quit ( printf "lru mode flat\r\nquit\r\n" | te.netlib3-client ${HOSTNAME} ${PORT} )

not as good workaround: turn off the hot and warm caches be similar to flat mode不太好的解决方法:关闭hot缓存warm缓存类似于flat模式

This idea is from the memcached/doc/protocol.txt section lru mode flat where it says:这个想法来自memcached/doc/protocol.txt部分lru mode flat ,它说:

If switching from segmented to flat mode, the background thread will pull items from HOT|WARM into COLD queue.如果从分段模式切换到平面模式,后台线程会将项目从 HOT|WARM 拉入 COLD 队列。

  • at the start use command line argument --extended hot_lru_pct=0,warm_lru_pct=0在开始时使用命令行参数--extended hot_lru_pct=0,warm_lru_pct=0
  • the idea is to use the --extended options to set the equivalent of lru tune 0 0 0.20 2.00 (current default is lru tune 20 40 0.20 2.00 i think)这个想法是使用--extended选项来设置lru tune 0 0 0.20 2.00的等价物(我认为当前默认是lru tune 20 40 0.20 2.00

update: i tested this command line option and the above command line errors out because of the values.更新:我测试了这个命令行选项和上面的命令行错误,因为这些值。 the pct fields require the value to be >= 1. factor fields require the values to be > 0.0. pct字段要求值 >= 1。 factor字段要求值 > 0.0。

  • here is the new command line: --extended hot_lru_pct=1,warm_lru_pct=1,hot_max_factor=0.0000000001,warm_max_factor=0.0000000001这是新的命令行: --extended hot_lru_pct=1,warm_lru_pct=1,hot_max_factor=0.0000000001,warm_max_factor=0.0000000001
  • this command does not: turn off the hot/warm caches or change the mode to flat此命令不会:关闭热/暖缓存或将模式更改为flat
  • this command does: tells memcached to always move hot and warm items to cold此命令的作用:告诉 memcached 始终将热项目和暖项目移至冷项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM