Flow-IPC / flow

Flow - Modern C++ toolkit for async loops, logs, config, benchmarking, and more [See also `ipc` repo]
https://flow-ipc.github.io/
Apache License 2.0
7 stars 0 forks source link

flow.async: In ..._task_loop, add a way to get number of pending jobs in the thread pool job queue. #62

Open ygoldfeld opened 7 months ago

ygoldfeld commented 7 months ago

In flow::async::*_task_loop, add a way to get number of pending jobs in the thread pool job queue.

ygoldfeld commented 7 months ago

I did not file the original ticket in pre-open-source days but added this comment back then:

That's actually quite a topic I have been thinking about, which is referenced in , regarding better balancing in Segregated_thread_taskloop (note: Cross... uses boost.asio which balances it itself) and in the optional per_thread_ops() feature of the Concurrent_task_loop hierarchy. The job queue size is helpful for that and other things. It's quite a topic. I'll need to think a lot about this; it's complicated.

--

The link talks about the following Host_resolver class being used elsewhere. For context including it here:

---snip---

Currently Host_resolver starts a manually configured # of threads (a quite conservative high number, 500 default). That's fine - no reason to think it's insufficient (although there may be overhead in so many threads, not something we're deeply worried about, but it's out there).

It would be better to automatically start threads as needed. Minimally:

---end-snip---

Revisit this with original reporter (Arun Poruri), in case there are more thoughts nowadays.