-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于kv键值对被清理的问题 #48
Comments
recycle_valid_entries = true value_policy.avg_key_ttl = 5 |
1 similar comment
recycle_valid_entries = true value_policy.avg_key_ttl = 5 |
好的,谢谢 |
另外还有一个问题想请教一下,如果当多个进程同一时间读同一个k值,会不会造成什么影响,比如程序崩溃的情况? |
支持多个进程对同一个 key 进行读写,不会导致程序崩溃。 |
但我的程序中遇到了这个现象,当两个进程同一时间读同一个k值时,程序崩溃了(PS:读共享内存时没有加锁),请问这种情况可能的原因是什么 |
好的,我排查一下。 |
应该是没有加锁的问题,后续我修复一下这个问题。 |
这个问题应该是修复了,请下载最新代码重新编译和安装。 配置文件 /etc/libshmcache.conf:
将 lock_policy.read_within_lock 修改为 true,即:
友情提示:老版本没有这个配置项,请添加进去。 |
好的,十分感谢! 还需要请教一个关于ttl回收机制的问题。我现在的配置文件设置recycle_valid_entries = false,value_policy.avg_key_ttl = 0。 我的写线程中:首次,我调用ttl=1s的set接口写入了30个kv对,之后测试程序延迟1s,再次写入这30个kv对中的某一对(操作完线程关闭) 我的读线程中:一直循环读这30个kv对,按理来说程序延迟1s后,其他29对应该是被删除状态,且过一段时间,30对都是被删除状态。但实际表现却并不是这样,30对kv对依旧能被读到。 请问这是什么原因导致的? |
另外就是还想咨询一下,回收机制和set的资源消耗问题。对30个kv对回收所消耗的时间 和 将这30个kv对写0 哪个会更加耗时一些? |
建议检查一下你们的测试程序逻辑。 |
当我设置recycle_valid_entries = true以及value_policy.avg_key_ttl = 5时,我发现我的程序过一段时间最先初始化一次写入的kv对无法获取了,请问和这两个参数配置有关系吗?
我的配置文件如下:
`
type = mmap
filename = /tmp/matrix_robot_shmcache
max_memory = 32M
min_memory = 0
segment_size = 2M
max_key_count = 200000
max_value_size = 256K
hash_function = simple_hash
recycle_key_once = 0
recycle_valid_entries = true
value_policy.avg_key_ttl = 5
value_policy.discard_memory_size = 128
value_policy.max_fail_times = 5
value_policy.sleep_us_when_recycle_valid_entries = 1000
lock_policy.trylock_interval_us = 200
lock_policy.detect_deadlock_interval_ms = 1000
log_level = debug
`
此外,我的往共享内存写接口的设置如下:
auto result = shmcache_set(&context_, &key_info, data.c_str(), data.size(), SHMCACHE_NEVER_EXPIRED);
The text was updated successfully, but these errors were encountered: