Default engine workers to the number of CPUs
The engine is single-threaded and thus needs more workers to handle more concurrent requests on a single machine. Change-Id: I36117c3876f84a2ff7ba5576444fdbf7716cc69e
This commit is contained in:
parent
0bb12320f5
commit
5604168784
@ -21,6 +21,7 @@ which then calls into this engine.
|
||||
import eventlet
|
||||
eventlet.monkey_patch()
|
||||
|
||||
import multiprocessing
|
||||
import os
|
||||
import sys
|
||||
|
||||
@ -61,7 +62,11 @@ if __name__ == '__main__':
|
||||
|
||||
from heat.engine import service as engine
|
||||
|
||||
num_workers = cfg.CONF.num_engine_workers
|
||||
if num_workers == -1:
|
||||
num_workers = multiprocessing.cpu_count()
|
||||
|
||||
srv = engine.EngineService(cfg.CONF.host, rpc_api.ENGINE_TOPIC)
|
||||
launcher = service.launch(srv, workers=cfg.CONF.num_engine_workers)
|
||||
launcher = service.launch(srv, workers=num_workers)
|
||||
notify.startup_notify(cfg.CONF.onready)
|
||||
launcher.wait()
|
||||
|
@ -77,8 +77,9 @@ service_opts = [
|
||||
default=3,
|
||||
help='Maximum depth allowed when using nested stacks.'),
|
||||
cfg.IntOpt('num_engine_workers',
|
||||
default=1,
|
||||
help='Number of heat-engine processes to fork and run.')]
|
||||
default=-1,
|
||||
help='Number of heat-engine processes to fork and run. -1'
|
||||
' will spawn a worker for each CPU on the machine')]
|
||||
|
||||
engine_opts = [
|
||||
cfg.StrOpt('instance_user',
|
||||
|
Loading…
Reference in New Issue
Block a user