通知代理协调

https://blueprints.launchpad.net/ceilometer/+spec/notification-coordination

问题描述

目前,通知代理可以在主动/主动 HA 模式下运行,每个通知代理以轮询方式从消息队列中获取通知(检查消息,获取消息)。出现的问题是,如果我们想要实现一个处理事件的管道,我们无法保证每个代理工作进程将获得哪个事件,因此我们无法启用聚合/关联相似事件关系的转换器。

这也修复了一个现有 bug,即如果启用了多个通知代理,管道转换器可能无法按预期工作,因为它只会对当前工作进程看到的样本进行操作。

提议的变更

类似于我们在中央代理之间实现协调的方式,此 bp 旨在提出一种协调事件传递到哪个通知代理的方法。

建议的解决方案是实现额外的处理步骤如下

1. Existing listener in notification agent continues as is, each agent will
   listen to the same queue and grab messages as they arrive without any
   coordination.
2. After the agent has converted messages into samples and events, the result
   will be republished onto a ceilometer internal queue. The sample and event
   will be published to (multiple) topics corresponding to known pipeline
   sinks. For example, the pipeline has two sinks, one that processes all
   meters, the other only processes compute meters. In this case, all agents
   will publish to a queue for 'all-meters' sink, and agents with compute
   meters will publish to 'compute-only' sink.
3. An additional listener will be added to each agent which will listen
   to new internal queues. This is where the coordination will happen. Each
   agent will listen to a set of targets created in step 2.

现有的通知代理将保持不变,因为不需要额外的队列来处理单个工作进程场景。

替代方案

  1. 通知代理可以跨现有目标进行协调,例如每个现有项目的交换机。这不允许跨交换机 sink。例如,我们无法拥有将来自不同项目的事件组合在一起的聚合。这对于样本来说可能不是问题(谁需要聚合和转换来自 nova 和 neutron 的新样本?)。这可能对于事件来说是一个问题,我们可能希望跨交换机协调事件。这意味着我们应该有样本监听器来跨交换机协调,以及事件监听器来执行上述操作。

  2. 通知代理可以跨端点进行协调。这将导致问题,因为我们需要拥有每个代理都监听的重复队列(以确保具有端点的代理获得所需的消息)。它还可能因为重复队列而导致消息丢失或重复。

数据模型影响

无。

REST API 影响

无。

安全影响

与现有轮询代理面临的安全问题相同 – 我们需要确保幻影代理无法注册并创建幻影任务。

Pipeline 影响

当部署多个工作进程时,它应该能够正常工作。后续 bp 和补丁将添加额外的事件管道。

其他最终用户影响

无。

性能/可扩展性影响

这应该提高写入性能(至少从 SQL 的角度来看),因为我们可以执行批量插入。

其他部署影响

用户需要启用协调。默认情况下,预计通知代理将继续像当前一样运行,即如果存在消息则拉取消息。

开发者影响

无。

实现

负责人

主要负责人

chungg

持续维护者

chungg

工作项

  • 添加通知代理协调

  • 重用或添加协调测试

未来生命周期

添加事件特定管道的第一步。

依赖项

  • tooz

  • tooz 的后端之一(ZooKeeper、memcached、redis 等…)

测试

  • 协调测试存在。如果现有的代理协调测试是中央代理特定的,我们可能只需要将其添加到通知代理。

文档影响

  • 添加有关启用通知代理协调的说明。

参考资料

[1] https://github.com/openstack/ceilometer-specs/blob/master/specs/juno/central-agent-partitioning.rst