-
Notifications
You must be signed in to change notification settings - Fork 154
Description
WorkerCount() defined in utils/runtime/runtime.go is called by node/main.go to determine the optimal worker count for the standalone node without explicit worker configuration. It should return a safe worker count for a given machine.
The current WorkerCount() implementation only considers the CPU thread (a.k.a. logical core) count while ignoring the memory and disk space requirements defined by the corresponding 1:2:4 golden ratio.
There are some memory checks and warnings implemented in node/main.go, but are marginally useful in the highlighter less experience node operator use case.
We could consider the memory requirement to be a must and include it in the WorkerCount() implementation. The disk space requirement could log a warning, if not met, and be left for the user to fix (which should be much simpler that adding more memory).
We may also consider moving all worker requirements (such as memory and disk) and warnings to a dedicated class (such as utils/runtime/runtime.go) instead of hard-coding them in node/main.go. That would make code cleaner and easier to read and edit.