]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Minimize the cost of checking for api worker exit
authorMaru Newby <marun@redhat.com>
Mon, 20 Jan 2014 19:28:03 +0000 (19:28 +0000)
committerMaru Newby <marun@redhat.com>
Tue, 21 Jan 2014 04:05:35 +0000 (04:05 +0000)
A recent change to oslo allows the configuration of the interval
that ProcessLauncher waits between checks of child exit.  The
default interval of 0.01s resulted in the neutron service consuming
unnecessary cpu cycles checking whether api workers had exited (5%
cpu on idle in a VM).  This patch extends the interval to 1s to
minimize the cost of the checks.

Change-Id: I0407ccb2db65cd3839586faff15e70dbc35f005e
Closes-bug: #1095346

neutron/wsgi.py

index 9e7964b4582f8e4f1c9fd6b222846b8df88e44be..981efbd982451b87831dd0f60b952bbe94d4c9c8 100644 (file)
@@ -211,7 +211,9 @@ class Server(object):
             self._server = self.pool.spawn(self._run, application,
                                            self._socket)
         else:
-            self._launcher = ProcessLauncher()
+            # Minimize the cost of checking for child exit by extending the
+            # wait interval past the default of 0.01s.
+            self._launcher = ProcessLauncher(wait_interval=1.0)
             self._server = WorkerService(self, application)
             self._launcher.launch_service(self._server, workers=workers)