tantivy icon indicating copy to clipboard operation
tantivy copied to clipboard

POC: Setting thread affinity on indexer threads

Open ChillFish8 opened this issue 2 years ago • 2 comments

Recently I wanted to test some smarter ways of balancing a large number of indexers in a multi-tenant situation without affecting searchers and decided to test out specifying specifically what CPU set the indexers could run on, giving searchers their own unaffected CPU set.

This is mostly an idea rather than a super useful feature, I've not included specifying the searcher CPU set as I'm not sure the best way to implement that in a way that doesn't result in extra calls when it doesn't need to be (i.e. SingleThreaded)

ChillFish8 avatar Aug 26 '23 20:08 ChillFish8

Have you measured a benefit?

fulmicoton avatar Aug 27 '23 00:08 fulmicoton

@fulmicoton I have yet to get around to testing the general performance change this has, I wanted this particular feature to allow some better control over the indexing threads preventing indexers from interfering with searchers since tantivy spawns its own set of threads internally unlike the searchers.

The main advantage of this change is that you could spawn say 30 indexers all using 1 thread but constrain them to 6 CPU cores letting the OS load balance the indexers.

ChillFish8 avatar Sep 03 '23 11:09 ChillFish8