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
// 设置当前会话所有操作使用tendis扩展协议
config set session tendis_protocol_extend 1
// 如果该参数为1,表示所有command最后会多三个参数,
// 最后一个总是v1,表示v1版本扩展协议,
// 倒数第二个是key的版本,倒数第三个是时间戳(或者是全局ID)
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.
127.0.0.1:8903> config set session perf_level enable_count
OK
127.0.0.1:8903> keys *
1) "a"
2) "zz{a}"
3) "ss"
4) "abc"
(8.70s)
127.0.0.1:8903> info rocksdbperfstats # 显示keys指令的perf context
# RocksdbPerfstats
user_key_comparison_count:31
block_cache_hit_count:3
block_read_count:0
block_read_byte:0
block_read_time:0
block_cache_index_hit_count:0
index_block_read_count:0
block_cache_filter_hit_count:0
filter_block_read_count:0
compression_dict_block_read_count:0
block_checksum_time:0
block_decompress_time:0
get_read_bytes:0
multiget_read_bytes:0
iter_read_bytes:5336
internal_key_skipped_count:16
internal_delete_skipped_count:0
internal_recent_skipped_count:0
internal_merge_count:0
write_wal_time:0
get_snapshot_time:0
get_from_memtable_time:0
get_from_memtable_count:0
get_post_process_time:0
get_from_output_files_time:0
seek_on_memtable_time:0
seek_on_memtable_count:20
next_on_memtable_count:0
prev_on_memtable_count:0
seek_child_seek_time:0
seek_child_seek_count:10
seek_min_heap_time:0
seek_internal_seek_time:0
find_next_user_entry_time:0
write_pre_and_post_process_time:0
write_memtable_time:0
write_thread_wait_nanos:0
write_scheduling_flushes_compactions_time:0
db_mutex_lock_nanos:0
db_condition_wait_nanos:0
merge_operator_time_nanos:0
write_delay_time:0
read_index_block_nanos:0
read_filter_block_nanos:0
new_table_block_iter_nanos:0
new_table_iterator_nanos:0
block_seek_nanos:0
find_table_nanos:0
bloom_memtable_hit_count:0
bloom_memtable_miss_count:0
bloom_sst_hit_count:0
bloom_sst_miss_count:0
key_lock_wait_time:0
key_lock_wait_count:0
env_new_sequential_file_nanos:0
env_new_random_access_file_nanos:0
env_new_writable_file_nanos:0
env_reuse_writable_file_nanos:0
env_new_random_rw_file_nanos:0
env_new_directory_nanos:0
env_file_exists_nanos:0
env_get_children_nanos:0
env_get_children_file_attributes_nanos:0
env_delete_file_nanos:0
env_create_dir_nanos:0
env_create_dir_if_missing_nanos:0
env_delete_dir_nanos:0
env_get_file_size_nanos:0
env_get_file_modification_time_nanos:0
env_rename_file_nanos:0
env_link_file_nanos:0
env_lock_file_nanos:0
env_unlock_file_nanos:0
env_new_logger_nanos:0
get_cpu_nanos:0
thread_pool_id:3
bytes_read:0
bytes_written:0
open_nanos:0
allocate_nanos:0
write_nanos:0
read_nanos:0
range_sync_nanos:0
fsync_nanos:0
prepare_write_nanos:0
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.