Remove shuffle_time_before_polling_task option

The problem that shuffle_time_before_polling_task tries to solve is the startup
of a horde of Ceilometer instances that would start polling the same thing at
the same time.

It's actually unlikely they would all start at the same right second, and the
correct fix would be to do that each time.

Related-Bug: #1734898

Change-Id: If8141f6b48657c06e8e782eeef9b209dabb2097c
This commit is contained in:
Julien Danjou 2017-11-23 10:41:03 +01:00
parent 0e30d9d535
commit faac031a9b
3 changed files with 6 additions and 24 deletions

@ -17,8 +17,6 @@
import collections import collections
import itertools import itertools
import logging import logging
import random
import time
import uuid import uuid
from concurrent import futures from concurrent import futures
@ -49,12 +47,6 @@ OPTS = [
help='To reduce polling agent load, samples are sent to the ' help='To reduce polling agent load, samples are sent to the '
'notification agent in a batch. To gain higher ' 'notification agent in a batch. To gain higher '
'throughput at the cost of load set this to False.'), 'throughput at the cost of load set this to False.'),
cfg.FloatOpt('shuffle_time_before_polling_task',
min=0,
default=10,
help='To reduce large requests at same time to Nova or other '
'components from different compute agents, shuffle '
'start time of polling task.'),
] ]
POLLING_OPTS = [ POLLING_OPTS = [
@ -363,16 +355,7 @@ class AgentManager(cotyledon.Service):
def construct_group_id(self, discovery_group_id): def construct_group_id(self, discovery_group_id):
return '%s-%s' % (self.group_prefix, discovery_group_id) return '%s-%s' % (self.group_prefix, discovery_group_id)
@staticmethod
def _delayed(delay, target, *args, **kwargs):
time.sleep(delay)
return target(*args, **kwargs)
def start_polling_tasks(self): def start_polling_tasks(self):
# set shuffle time before polling task if necessary
delay_polling_time = random.randint(
0, self.conf.shuffle_time_before_polling_task)
data = self.setup_polling_tasks() data = self.setup_polling_tasks()
# Don't start useless threads if no task will run # Don't start useless threads if no task will run
@ -390,8 +373,7 @@ class AgentManager(cotyledon.Service):
def task(running_task): def task(running_task):
self.interval_task(running_task) self.interval_task(running_task)
utils.spawn_thread(self._delayed, delay_polling_time, self.polling_periodics.add(task, polling_task)
self.polling_periodics.add, task, polling_task)
utils.spawn_thread(self.polling_periodics.start, allow_empty=True) utils.spawn_thread(self.polling_periodics.start, allow_empty=True)

@ -33,10 +33,6 @@ from ceilometer import service
from ceilometer.tests import base from ceilometer.tests import base
def fakedelayed(delay, target, *args, **kwargs):
return target(*args, **kwargs)
def default_test_data(name='test'): def default_test_data(name='test'):
return sample.Sample( return sample.Sample(
name=name, name=name,
@ -823,7 +819,6 @@ class TestPollingAgent(BaseAgent):
'publishers': ["test"]}] 'publishers': ["test"]}]
} }
self.setup_polling(poll_cfg) self.setup_polling(poll_cfg)
self.mgr._delayed = fakedelayed
polling_task = list(self.mgr.setup_polling_tasks().values())[0] polling_task = list(self.mgr.setup_polling_tasks().values())[0]
self.mgr.interval_task(polling_task) self.mgr.interval_task(polling_task)

@ -0,0 +1,5 @@
---
deprecations:
- |
The `shuffle_time_before_polling_task` option has been removed. This option
never worked in the way it was originally intended too.