We waste RAM by keeping extrainfos, microdescs, and descriptors allocated locally after we have saved them to the journal. Instead, we could mmap the journal, and use mremap to grow it as we expand.
#7176 (moved) has a patch for this that could use some review and revision.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items 0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items 0
Link issues together to show that they're related.
Learn more.
This patch kills off the "write to X.tmp, then rename to X" logic globally. That's not okay to do. If it turns out to be necessary on low-disk systems, then we should do it on those systems only, and we should do it for the cached-* files only.
The mmap-logic is unix-only. We need to support Windows too.
I'm missing something, but I don't understand how anonymous memory maps actually help here. Is it a memory fragmentation issue or something? An anonymous mmap is RAM-backed and swappable, right?
load_string_into_mmap should have a name like tor_mmap_append(); it should work on file mmaps too (maybe it does?), and it should do at most one increment and copy the data all at once.
likewise for load_file_into_mmap -- and why would you even do that when you can just mmap the file?
There should be a wrapper function that does a nul-terminated memdup for a single microdesc/descriptor.
It may be a lower priority to do this for routerdescs and extrainfos: clients don't use those, after all.
I think we can reuse some of the code from the original patch, but we should really write a completely new branch here if we decide to do this one.