by marginalia_nu · 1y ago · 0 comments
I'm 97% certain this is because the faster code leads to more page thrashing in the mmap-based index readers. I'm gonna have to implement my own buffer pool and manage my reads directly like that vexatious paper[1] said all along.
[1] https://db.cs.cmu.edu/papers/2022/cidr2022-p13-crotty.pdf
You make it sound like I was trying to troll everyone when we wrote that paper. We were warning you.
Is it being cached for future queries or are you just talking about putting it in memory to perform the computation for a query?
Caching will likely be fairly tuned toward the operation itself, since it's not a general-purpose DBMS and I can fairly accurately predict which pages will likely be useful to cache or when read-ahead is likely to be fruitful based on the operation being performed.
For keyword-document mappings some LRU cache scheme is likely a good fit, when reading a list of documents readahead is good (and I can inform the pool of how far to read ahead), when intersecting document lists I can also generally predict when pages are likely to be re-read or needed in the future based on the position in the tree.
Will definitely need a fair bit of tuning but overall the problem is greatly simplified by revolving around very specific types of access patterns.
Edit: I should specify they shard the corpus by document so there isn't a replica with the entire term dict on it.