[[Xtsdb]]にて、[[notes/system-engineering/Redis]]のExpireが遅れて見えた理由はhzの設定がおとなしかったか、dynamic-hzが効いていたせいかもしれない。 [http://download.redis.io/redis-stable/redis.conf](http://download.redis.io/redis-stable/redis.conf) ``` # Redis calls an internal function to perform many background tasks, like # closing connections of clients in timeout, purging expired keys that are # never requested, and so forth. # # Not all tasks are performed with the same frequency, but Redis checks for # tasks to perform according to the specified "hz" value. # # By default "hz" is set to 10. Raising the value will use more CPU when # Redis is idle, but at the same time will make Redis more responsive when # there are many keys expiring at the same time, and timeouts may be # handled with more precision. # # The range is between 1 and 500, however a value over 100 is usually not # a good idea. Most users should use the default of 10 and raise this up to # 100 only in environments where very low latency is required. hz 10 # Normally it is useful to have an HZ value which is proportional to the # number of clients connected. This is useful in order, for instance, to # avoid too many clients are processed for each background task invocation # in order to avoid latency spikes. # # Since the default HZ value by default is conservatively set to 10, Redis # offers, and enables by default, the ability to use an adaptive HZ value # which will temporary raise when there are many connected clients. # # When dynamic HZ is enabled, the actual configured HZ will be used # as a baseline, but multiples of the configured HZ value will be actually # used as needed once more clients are connected. In this way an idle # instance will use very little CPU time while a busy instance will be # more responsive. dynamic-hz yes ``` xtsdb-flusherが動きはじめると、RedisのCPU利用率が低下してしまうので、なにかでRedisサーバ内の処理がブロックされているはずなんだけどそれがなにかわかっていない。下記のcommandstatsをながめてみたり、[Redisのレイテンシ監視機能](https://redis.io/topics/latency)で調べるものの原因はわからず。 ```bash > ubuntu@xtsdb-05:~$ redis-cli info commandstats # Commandstats cmdstat_xack:calls=356001,usec=9571867,usec_per_call=26.89 cmdstat_set:calls=1743379,usec=7371517,usec_per_call=4.23 cmdstat_del:calls=1341539,usec=11862483,usec_per_call=8.84 cmdstat_slowlog:calls=3173,usec=30382,usec_per_call=9.58 cmdstat_cluster:calls=1607,usec=129277,usec_per_call=80.45 cmdstat_script:calls=35,usec=333,usec_per_call=9.51 cmdstat_subscribe:calls=2,usec=7,usec_per_call=3.50 cmdstat_config:calls=1583,usec=192364,usec_per_call=121.52 cmdstat_unlink:calls=1341539,usec=9956028,usec_per_call=7.42 cmdstat_xreadgroup:calls=356009,usec=35217958,usec_per_call=98.92 cmdstat_get:calls=1341539,usec=7149131,usec_per_call=5.33 cmdstat_evalsha:calls=3863383,usec=2835736233,usec_per_call=734.00 cmdstat_command:calls=7,usec=9577,usec_per_call=1368.14 cmdstat_info:calls=1584,usec=305764,usec_per_call=193.03 cmdstat_ping:calls=241,usec=981,usec_per_call=4.07 cmdstat_xadd:calls=3025485,usec=29998365,usec_per_call=9.92 cmdstat_exists:calls=291170880,usec=435912232,usec_per_call=1.50 cmdstat_latency:calls=1603,usec=96484,usec_per_call=60.19 cmdstat_client:calls=1580,usec=4869,usec_per_call=3.08 cmdstat_append:calls=291170880,usec=620470359,usec_per_call=2.13 cmdstat_ttl:calls=289427501,usec=182780900,usec_per_call=0.63 cmdstat_xdel:calls=356001,usec=26409850,usec_per_call=74.18 cmdstat_xgroup:calls=9,usec=735,usec_per_call=81.67 cmdstat_flushall:calls=3,usec=600429,usec_per_call=200143.00 ```