By default, openHAB only starts 5
threads to deal with execution of Rules. That’s not a lot, and if all threads are busy, rules have to wait until a slot is free. This results in slow Rule
response time.
This can be improved.
The thread pool used by openHAB is defined in /etc/openhab2/services/runtime.cfg
. Adding a line with org.eclipse.smarthome.threadpool:ruleEngine=
will define the new number of threads used for the Rules engine. Rolling this out using Ansible, I use a lineinfile Task to update the configuration file:
|
|
Most likely this config entry will not be there in the beginning, then the default of 5
is used. Adding this setting, and restarting openHAB results in 20
threads. Verification by using /usr/share/openhab2/runtime/bin/client
:
openhab> config:list "(service.pid=org.eclipse.smarthome.threadpool)"
----------------------------------------------------------------
Pid: org.eclipse.smarthome.threadpool
BundleLocation: null
Properties:
discovery = 5
ruleEngine = 20
safeCall = 10
service.pid = org.eclipse.smarthome.threadpool
thingHandler = 5
|
|
The system is more responsive now, but with added workload the 20
might not even be enough in the future.