From afe102b2e493d3d5513de545a7679484e83878ce Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 10 Jun 2023 13:50:00 +0200 Subject: [PATCH] docs: refine worker choice strategies documentation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- README.md | 2 +- src/pools/selection-strategies/README.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cb45449c..04fa3ab9 100644 --- a/README.md +++ b/README.md @@ -281,7 +281,7 @@ But in general, **always profile your application**. To choose your pool consider that with a FixedThreadPool/FixedClusterPool or a DynamicThreadPool/DynamicClusterPool (in this case is important the min parameter passed to the constructor) your application memory footprint will increase. Increasing the memory footprint, your application will be ready to accept more tasks, but during idle time your application will consume more memory. -One good choose from my point of view is to profile your application using Fixed/Dynamic worker pool, and to see your application metrics when you increase/decrease the num of workers. +One good choice from poolifier team point of view is to profile your application using fixed or dynamic worker pool, and to see your application metrics when you increase/decrease the num of workers. For example you could keep the memory footprint low choosing a DynamicThreadPool/DynamicClusterPool with 5 workers, and allow to create new workers until 50/100 when needed, this is the advantage to use the DynamicThreadPool/DynamicClusterPool. But in general, **always profile your application**. diff --git a/src/pools/selection-strategies/README.md b/src/pools/selection-strategies/README.md index 9e409cdf..5093beb6 100644 --- a/src/pools/selection-strategies/README.md +++ b/src/pools/selection-strategies/README.md @@ -9,10 +9,14 @@ By default, the strategy uses the average task execution time for each worker bu ### Weighted round robin +The strategy assigns the next task using a robin round algorithm. The worker weights are maximum tasks execution time, once the worker has reached its maximum tasks execution time, the next task is assigned to the next worker. + ### Interleaved weighted round robin ## Statistics +Worker choice strategies enable only the statistics that are needed to choose the next worker to avoid unnecessary overhead. + ### Median Strategies using the average task execution time for each worker can use the median instead. Median is more robust to outliers and can be used to avoid assigning tasks to workers that are currently overloaded. Median usage introduces a small overhead: measurement history must be kept for each worker and the median must be recomputed each time a new task has finished. -- 2.34.1