Revert "Ipv4.Fragments: use a mutable LRU cache (Lru.M.t instead of mutable cache : Lru.F.t):" #423
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts commit 2201224.
The motivation behind this change is that Lru.M.t uses a hashtable, pre-allocated in the size of the capacity (256 * 1024 ~> 2MB just for the keys (stored in an array)). This leads to quite some memory usage (as observed in mirage/qubes-mirage-firewall#93).
But the issue is slightly more complex: an OCaml hashtable has amortized time complexity of O(1), but in worst cases it may be much bigger (adding an element may lead to resize, which means allocation of a fresh array, re-hashing of all keys, and copying) -- leading to unpredictable behaviour, which is not what we want in real systems. Also, a hashtable is never shrinking its array.
I'm fine to revert this change once we find the performance bottleneck being in the IPv4 fragment cache.
//cc @talex5