Replies: 4 comments 3 replies
-
Hi @Thomblin, The load factor of hash map containers (including std::collection::hash_map) is anecdotally kept at around 50%. In your case, the number of entries decreased from 30 million to 10 million, so I assume the hashmap's capacity was 64 million. scc::HashMap starts to shrink when the load factor reaches ~6%, while 10 million entries amount to ~15% of the capacity. This means that in order for scc::HashMap to shrink, more entries should be removed. In other words, scc::HashMap's shrinking policy is very conservative, so your application's memory consumption stays almost the same. I may have to introduce a way to set a custom shrinking policy later. |
Beta Was this translation helpful? Give feedback.
-
That make sense. Regarding constant generics. I guess you mean to change
to something like
I would think that the HashTable contains too many generics then. Is it worth the mess? Else maybe something like the following. Either way, it would be a breaking change I guess. pub trait Config {
const TYPE: char;
const SHRINK: usize;
const LOAD: usize;
}
pub(super) trait HashTable<K, V, H, L: LruList, C: Config> I cannot tell how many people would actually use it (me included, now that I learned more about it). So maybe it breaks too much for some more flexibility. What do you think? |
Beta Was this translation helpful? Give feedback.
-
I like this idea,
and it would not be a breaking change as long as a default config is provided. On the other hand, I can just relax the shrinking policy (e.g., shrink if len/capacity < 0.1-0.25) as that does not affect overall performance much. |
Beta Was this translation helpful? Give feedback.
-
So. I am still experimenting with this. I guess I lack some deeper Rust knowledge. Adding the Config creates a lot of troubles with the compiler, as it needs to know the exact implementation during compile time, which might not be what we want. Using dyn Config seems not to be allowed. In case you want to take a look at it, maybe you have an idea: https://github.com/Thomblin/scalable-concurrent-containers/pull/1/files |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I am currently prototyping a service which stores up to 30 million entries in one scc hashmap and a little above 1 million entries in another scc hashmap, consuming up to around 80 GB of memory. During night there is less traffic and the entries are removed step by step to around 10 million and 500.000 entries. According to https://docs.rs/scc/latest/scc/hash_map/struct.HashMap.html#resize I would expect that the memory consumption of my service shrinks accordingly, however so far I can only observe that it stays at the highest level. Is that expected, or do I need to call a certain function?
My data structure looks like this:
Beta Was this translation helpful? Give feedback.
All reactions