From 952489020ea36aced3737079fa17eff2e37b4da7 Mon Sep 17 00:00:00 2001 From: Fedor Tarasenko Date: Mon, 25 May 2020 22:18:17 +0300 Subject: [PATCH] Fix an issue with high cpu usage caused by ironic-python-agent Currently running of ipa-centos8-stable-ussuri image causes 100% cpu usage while cleaning. Proposed change fixes this behavior and significantly speeds up cleaning. Change-Id: I2ba9a69f22b11830d8ff1bc346b17bf1a52f25b0 Story: #2007696 Task: #39809 --- ironic_python_agent/agent.py | 2 +- .../fix-high-cpu-usage-eventlet-1dccf3b81dd42c47.yaml | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-high-cpu-usage-eventlet-1dccf3b81dd42c47.yaml diff --git a/ironic_python_agent/agent.py b/ironic_python_agent/agent.py index 7b1b3e8ea..5eb1e28dd 100644 --- a/ironic_python_agent/agent.py +++ b/ironic_python_agent/agent.py @@ -381,7 +381,7 @@ class IronicPythonAgent(base.ExecuteCommandMixin): self.heartbeater.start() try: while self.serve_api: - eventlet.sleep(0) + eventlet.sleep(0.1) except KeyboardInterrupt: LOG.info('Caught keyboard interrupt, exiting') self.api.stop() diff --git a/releasenotes/notes/fix-high-cpu-usage-eventlet-1dccf3b81dd42c47.yaml b/releasenotes/notes/fix-high-cpu-usage-eventlet-1dccf3b81dd42c47.yaml new file mode 100644 index 000000000..e77a68007 --- /dev/null +++ b/releasenotes/notes/fix-high-cpu-usage-eventlet-1dccf3b81dd42c47.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Fixes an issue with high cpu usage caused by ironic-python-agent greenthread + eventlent implementation. + + Using eventlet.sleep(0.1) instead of eventlet.sleep(0) gives other processes + of IPA more cpu time to run.