CONFIG GET parameter

Available since 1.0.0.

命令说明

用户获取指定parameter的值

命令返回

Simple string reply: OK when the configuration was set properly. Otherwise an error is returned.

Examples

如上

CONFIG SET [session] parameter value

Available since 1.0.0.

命令说明

Redis一致,用于修改Tendis存储版的配置值。不同的是,Tendis存储版增加了session选项,表示仅仅修改当前会话配置值。

当指定session时,parameter支持

  • tendis_protocol_extend,用于开启versionep协议
  • perf_level,用于开启会话性能调试

参数说明

tendis_protocol_extend

  1. // 设置当前会话所有操作使用tendis扩展协议
  2. config set session tendis_protocol_extend 1
  3. // 如果该参数为1,表示所有command最后会多三个参数,
  4. // 最后一个总是v1,表示v1版本扩展协议,
  5. // 倒数第二个是key的版本,倒数第三个是时间戳(或者是全局ID)
  6. sadd x a <timestamp> <revision> v1

perf_level

如果想分析某一个命令在执行性能,可以使用开启Perf Context,通过info rocksdbperfstats显示rocksdb内部的运行情况。

其中,value的有效值是

  • enable_count
  • enable_time_expect_for_mutex
  • enable_time_and_cputime_expect_for_mutex
  • enable_time

对应rocksdb的四个level,下面引入来自rocksdb的文档。

Profile Levels And Costs

As always, there are trade-offs between statistics quantity and overhead, so we have designed several profile levels to choose from:

  • kEnableCount will only enable counters.
  • kEnableTimeAndCPUTimeExceptForMutex is introduced since CPU Time counters are introduced. With this level, non-mutex-timing related counters will be enabled, as well as CPU counters.
  • kEnableTimeExceptForMutex enables counter stats and most stats of time duration, except when the timing function needs to be called inside a shared mutex.
  • kEnableTime further adds stats for mutex acquisition and waiting time.

kEnableCount avoids the more expensive calls to get system times, which results in lower overhead. We often measure all of the operations using this level, and report them when specific counters are abnormal.

With kEnableTimeExceptForMutex, RocksDB may call the timing function dozens of times for an operation. Our common practice is to turn it on with sampled operations, or when the user requests it. Users need to be careful when choosing sample rates, since the cost of the timing functions varies across different platforms.

kEnableTime further allows timing within shared mutex, but profiling an operation may slow down other operations. When we suspect that mutex contention is the performance bottleneck, we use this level to verify the problem.

How do we deal with the counters disabled in a level? If a counter is disabled, it won’t be updated.

  1. 127.0.0.1:8903> config set session perf_level enable_count
  2. OK
  3. 127.0.0.1:8903> keys *
  4. 1) "a"
  5. 2) "zz{a}"
  6. 3) "ss"
  7. 4) "abc"
  8. (8.70s)
  9. 127.0.0.1:8903> info rocksdbperfstats # 显示keys指令的perf context
  10. # RocksdbPerfstats
  11. user_key_comparison_count:31
  12. block_cache_hit_count:3
  13. block_read_count:0
  14. block_read_byte:0
  15. block_read_time:0
  16. block_cache_index_hit_count:0
  17. index_block_read_count:0
  18. block_cache_filter_hit_count:0
  19. filter_block_read_count:0
  20. compression_dict_block_read_count:0
  21. block_checksum_time:0
  22. block_decompress_time:0
  23. get_read_bytes:0
  24. multiget_read_bytes:0
  25. iter_read_bytes:5336
  26. internal_key_skipped_count:16
  27. internal_delete_skipped_count:0
  28. internal_recent_skipped_count:0
  29. internal_merge_count:0
  30. write_wal_time:0
  31. get_snapshot_time:0
  32. get_from_memtable_time:0
  33. get_from_memtable_count:0
  34. get_post_process_time:0
  35. get_from_output_files_time:0
  36. seek_on_memtable_time:0
  37. seek_on_memtable_count:20
  38. next_on_memtable_count:0
  39. prev_on_memtable_count:0
  40. seek_child_seek_time:0
  41. seek_child_seek_count:10
  42. seek_min_heap_time:0
  43. seek_internal_seek_time:0
  44. find_next_user_entry_time:0
  45. write_pre_and_post_process_time:0
  46. write_memtable_time:0
  47. write_thread_wait_nanos:0
  48. write_scheduling_flushes_compactions_time:0
  49. db_mutex_lock_nanos:0
  50. db_condition_wait_nanos:0
  51. merge_operator_time_nanos:0
  52. write_delay_time:0
  53. read_index_block_nanos:0
  54. read_filter_block_nanos:0
  55. new_table_block_iter_nanos:0
  56. new_table_iterator_nanos:0
  57. block_seek_nanos:0
  58. find_table_nanos:0
  59. bloom_memtable_hit_count:0
  60. bloom_memtable_miss_count:0
  61. bloom_sst_hit_count:0
  62. bloom_sst_miss_count:0
  63. key_lock_wait_time:0
  64. key_lock_wait_count:0
  65. env_new_sequential_file_nanos:0
  66. env_new_random_access_file_nanos:0
  67. env_new_writable_file_nanos:0
  68. env_reuse_writable_file_nanos:0
  69. env_new_random_rw_file_nanos:0
  70. env_new_directory_nanos:0
  71. env_file_exists_nanos:0
  72. env_get_children_nanos:0
  73. env_get_children_file_attributes_nanos:0
  74. env_delete_file_nanos:0
  75. env_create_dir_nanos:0
  76. env_create_dir_if_missing_nanos:0
  77. env_delete_dir_nanos:0
  78. env_get_file_size_nanos:0
  79. env_get_file_modification_time_nanos:0
  80. env_rename_file_nanos:0
  81. env_link_file_nanos:0
  82. env_lock_file_nanos:0
  83. env_unlock_file_nanos:0
  84. env_new_logger_nanos:0
  85. get_cpu_nanos:0
  86. thread_pool_id:3
  87. bytes_read:0
  88. bytes_written:0
  89. open_nanos:0
  90. allocate_nanos:0
  91. write_nanos:0
  92. read_nanos:0
  93. range_sync_nanos:0
  94. fsync_nanos:0
  95. prepare_write_nanos:0
  96. logger_nanos:0

命令返回

Simple string reply: OK when the configuration was set properly. Otherwise an error is returned.

Examples

如上

CONFIG RESETSTAT [parameter]

Available since 1.0.0.

命令说明

在某些场景下,希望将以前的部分统计信息清零,便于后续的性能分析。在这种情况下,可以使用config resetstat命令,用于清空已经收集的统计信息。目前支持清空的parameter值有

参数说明

  • all:清空以下所有统计信息
  • unseencommands:重置非法命令统计信息
  • commandstats:重置info commandstat的统计信息
  • stats:重置info stats的统计信息
  • rocksdbstats:重置info rocksdbstats的统计信息

详见info

命令返回

Simple string reply: OK when the configuration was set properly. Otherwise an error is returned.