Hi Arthur,
One more question. I'm performing massive inserts to qc from different rayon threads, and I'm reserving the amount of entries I'm going to insert every time (this happens once every 3/4 seconds). Something like:
fn push_method_data_to_cache(method_id: u16, write_result: &WriteResult, queue: SegQueue<(i64, CacheValue)>, num_inserts: usize, log_msg_queue: &SegQueue<String>) {
let start = Instant::now();
if let Some(entry) = CACHES.data.pin().get(&method_id) {
entry.cache.reserve(num_inserts); // entry.cache is the 'quick cache'
while let Some(mut item) = queue.pop() {
item.1.second_dir = write_result.second_dir;
item.1.filename = write_result.filename;
entry.cache.insert(item.0, item.1);
}
}
}
The point is I know this cache is going to be full in several hours, so the question is if it's a good idea to pre-reserve all the 'estimated_items_capacity' on the cache creation:
let cache = get_cache(cache_items_capacity); // This is the quick_cache created with 'cache_items_capacity'
cache.reserve(cache_items_capacity); // <-- now reserve 'cache_items_capacity'
Thanks!
Joan.
Hi Arthur,
One more question. I'm performing massive inserts to qc from different rayon threads, and I'm reserving the amount of entries I'm going to insert every time (this happens once every 3/4 seconds). Something like:
The point is I know this cache is going to be full in several hours, so the question is if it's a good idea to pre-reserve all the 'estimated_items_capacity' on the cache creation:
let cache = get_cache(cache_items_capacity); // This is the quick_cache created with 'cache_items_capacity'
cache.reserve(cache_items_capacity); // <-- now reserve 'cache_items_capacity'
Thanks!
Joan.