From 46c1b6eaee4ca00c256c5c403c6d6bfeaf3b63f8 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Sun, 25 Mar 2012 02:06:01 +0800 Subject: Add multi-process support for API services Implements blueprint multi-process-api-service This is based on Huang Zhiteng's patch. This patch adds support for running services as multiple processes. This is primarily intended to be used with the API service as a way to provide more concurrency than eventlet can sometimes provide. A SIGTERM or SIGINT signal will cause the parent process to gracefully terminate the child processes, allowing them to finish processing the requests currently being processed. The parent will wait for the children to finish before exiting. Change-Id: Ie6d6802626eb42d5e64c4167be363fbf6cea2a1b --- bin/nova-api | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bin/nova-api') diff --git a/bin/nova-api b/bin/nova-api index e6779df4f..b778854f0 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -24,7 +24,7 @@ Starts both the EC2 and OpenStack APIs in separate greenthreads. """ import eventlet -eventlet.monkey_patch() +eventlet.monkey_patch(os=False) import os import sys @@ -45,8 +45,8 @@ if __name__ == '__main__': flags.parse_args(sys.argv) logging.setup() utils.monkey_patch() - servers = [] + launcher = service.ProcessLauncher() for api in flags.FLAGS.enabled_apis: - servers.append(service.WSGIService(api)) - service.serve(*servers) - service.wait() + server = service.WSGIService(api) + launcher.launch_server(server, workers=server.workers or 1) + launcher.wait() -- cgit