My server has the following requirements:
1) each new connection to the server will trigger a series of N posix_fadvise calls.
2) the first few fadvise calls per connection should happen ASAP
3) ability to re-order the fadvise calls if the client makes a
subsequent requests.
I am thinking: thread pool with shared queue, where thread pool size is ~100. Any other suggestions?
There is no point in having multiple threads blocking in
fadviseat the same time for the same underlying device, since they’re all sharing the same request queue anyway.This means that you should only need a single readahead thread, that takes readahead requests from a queue and executes them sequentially.