mirror of
https://github.com/Zygo/bees.git
synced 2025-08-02 22:03:29 +02:00
bees: dynamic thread pool size based on system load average
Add -g / --loadavg-target parameter to track system load and add or remove bees worker threads dynamically to keep system load close to the loadavg target. Thread count may vary from zero to the maximum specified by -c or -C, and is adjusted every 5 seconds. This is better than implementing a similar load average scheme from outside of the process (though that is still possible) because the in-process load tracker does not disrupt the performance timing feedback mechanisms as a freezer cgroup or SIGSTOP would when controlling bees from outside. The internal load average tracker can also adjust the number of active threads while an external tracker can only choose from the maximum or zero. Also fix a bug where a Task could deadlock waiting for itself to exit if it tries to insert a new Task after the number of worker threads has been set to zero. Also correct usage message for --scan-mode (values are 0..2) since we are touching adjacent lines anyway. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
11
README.md
11
README.md
@@ -535,13 +535,19 @@ Command Line Options
|
||||
--------------------
|
||||
|
||||
* --thread-count (-c) COUNT
|
||||
* Specify number of worker threads for scanning. Overrides --thread-factor (-C)
|
||||
and default/autodetected values.
|
||||
* Specify maximum number of worker threads for scanning. Overrides
|
||||
--thread-factor (-C) and default/autodetected values.
|
||||
* --thread-factor (-C) FACTOR
|
||||
* Specify ratio of worker threads to CPU cores. Overridden by --thread-count (-c).
|
||||
Default is 1.0, i.e. 1 worker thread per detected CPU. Use values
|
||||
below 1.0 to leave some cores idle, or above 1.0 if there are more
|
||||
disks than CPUs in the filesystem.
|
||||
* --loadavg-target (-g) LOADAVG
|
||||
* Specify load average target for dynamic worker threads.
|
||||
Threads will be started or stopped subject to the upper limit imposed
|
||||
by thread-factor and thread-count until the load average is within
|
||||
+/- 0.5 of LOADAVG.
|
||||
|
||||
* --scan-mode (-m) MODE
|
||||
* Specify extent scanning algorithm. Default mode is 0.
|
||||
_EXPERIMENTAL_ feature that may go away.
|
||||
@@ -552,6 +558,7 @@ Command Line Options
|
||||
on non-spinning media when subvols are unrelated.
|
||||
* Mode 2: scan all extents from one subvol at a time. Good sequential
|
||||
read performance for spinning media. Maximizes temporary space usage.
|
||||
|
||||
* --timestamps (-t)
|
||||
* Enable timestamps in log output.
|
||||
* --no-timestamps (-T)
|
||||
|
Reference in New Issue
Block a user