You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reconcilers implement the logic that drives the desired state to the actual state. In principle it's the same model as the operator framework provided by K8s, however as mentioned, it's tailored towards storage rather than stateless containers.
@@ -334,9 +384,10 @@ The value add is not the ANA feature itself, rather what you do with it.
334
384
335
385
## NATS & Fault management
336
386
337
-
We used to use NATS as a message bus within mayastor as a whole, but as since switched for gRPC for p2p communications. \
338
-
We will continue to use NATS for async notifications. Async in the sense that we send a message, but we do NOT wait for a reply. This mechanism does not
339
-
do any form of "consensus," retries, and the likes. Information transported over NATS will typically be error telemetry that is used to diagnose problems. No work has started yet on this subject.
387
+
We used to use [NATS] as a message bus within mayastor as a whole, but later switched to [gRPC] for p2p communications. \
388
+
As of today, we use [NATS] for [events](./events.md) as async notifications via the [Publish/Subscribe Model](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern). Our current mechanism does not do any form of "consensus," retries, and the likes. Information transported over NATS will typically be error telemetry that is used to diagnose problems.
389
+
390
+
> NOTE: We only have 1 event subscriber at the moment, which is the call-home stats aggregator.
340
391
341
392
At a high level, error detectors are placed in code parts where makes sense; for example, consider the following:
342
393
@@ -391,7 +442,7 @@ err.io.nvme.transport.* = {}
391
442
err.io.nexus.* = {}
392
443
```
393
444
394
-
Subscribes to these events will keep track of payloads and apply corrective actions. In its most simplistic form, it results in a model where one can
445
+
Subscribers to these events will keep track of payloads and apply corrective actions. In its most simplistic form, it results in a model where one can
395
446
define a per class for error an action that needs to be taken. This error handling can be applied to IO but also agents.
396
447
397
448
The content of the event can vary, containing some general metadata fields, as well as event specific information.
@@ -411,21 +462,22 @@ message EventMessage {
411
462
}
412
463
```
413
464
465
+
Read more about eventing [here](./events.md).
414
466
An up to date API of the event format can be fetched
Tracing means different things at different levels. In this case, we are referring to tracing component boundary tracing.
420
472
421
-
Tracing is by default implemented using open telemetry and, by default, we have provided a subscriber for jaeger. From jaeger, the information can be
422
-
forwarded to, Elastic Search, Cassandra, Kafka, or whatever. In order to achieve full tracing support, all the gRPC requests and replies should add
423
-
HTTP headers such that we can easily tie them together in whatever tooling is used. This is standard practice but requires a significant amount of work.
424
-
The key reason is to ensure that all requests and responses pass along the headers, from REST to the scheduling pipeline.
473
+
Tracing is implemented using open telemetry and, by default, we have provided a subscriber for [Jaeger]. From [Jaeger], the information can be
474
+
forwarded to, Elastic Search, Cassandra, Kafka, etc. In order to achieve full tracing support, all the [gRPC] requests and replies should add
475
+
`HTTP` headers such that we can easily tie them together in whatever tooling is used. This is standard practice but requires a significant amount of work.
476
+
The key reason is to ensure that all requests and responses pass along the headers, from `REST` to the scheduling pipeline.
425
477
426
-
We also need to support several types of transport and serialization mechanisms. For example, HTTP/1.1 REST requests to HTTP/2 gRCP request to
478
+
We also need to support several types of transport and serialization mechanisms. For example, `HTTP/1.1 REST` requests to `HTTP/2 gRPC` request to
427
479
a KV store operation to etcd. For this, we will use [Tower]. \
428
-
[Tower] provides a not-so-easy to use an abstraction of Request to Response mapping.
480
+
[Tower] provides a not-so-easy to use interface/abstraction of request to response mapping.
429
481
430
482
```rust
431
483
pubtraitService<Request> {
@@ -447,9 +499,9 @@ The provided services can then be layered with additional functions that add the
447
499
448
500
```rust
449
501
pubtraitLayer<S> {
450
-
/// The service for which we want to insert a new layer
502
+
/// The service for which we want to insert a new layer.
451
503
typeService;
452
-
/// the implementation of the layer itself
504
+
/// the implementation of the layer itself.
453
505
fnlayer(&self, inner:S) ->Self::Service;
454
506
}
455
507
```
@@ -458,23 +510,72 @@ An example where a `REST` client sets the open tracing key/values on the request
How do these traces get sent to [Jaeger] (or any other telemetry sink)? We setup an opentelemetry exporter on **every** service which is receiving and/or sending the tracing id's:
As part of mayastor we wanted to have event driven capabilities which can allow us to respond to certain events and perform specific actions. \
4
+
A message bus ([NATS]) had been initially used in early versions of mayastor, though since its initial use was mostly p2p, we ended up temporarily moving away from it in favour of [gRPC]. \
5
+
As a result of it, we ended up with high coupling between components, such as the io-engine and the core-agent.
6
+
7
+
With that out of the way, we still believe a message bus is a good solution for many use cases within mayastor:
8
+
9
+
1. Event driven reconcilers
10
+
2. Event accruing for metrics
11
+
3. Fault diagnostics system
12
+
4. etc
13
+
14
+
> **NOTE**: What's a message bus after all? It's a messaging system that allows applications to communicate with each other by sending and receiving messages. It acts as a broker that routes messages between senders and receivers which are loosely coupled.
15
+
16
+
## Enter NATS Jetstream
17
+
18
+
We've compared several options and ended up selecting [NATS] (again!) as the message bus for our eventing system.
19
+
20
+
"NATS has a built-in persistence engine called [Jetstream] which enables messages to be stored and replayed at a later time. Unlike NATS Core which requires you to have an active subscription to process messages as they happen, JetStream allows the NATS server to capture messages and replay them to consumers as needed. This functionality enables a different quality of service for your NATS messages, and enables fault-tolerant and high-availability configurations."
21
+
22
+
### Pros of NATS
23
+
24
+
- Always on and available (Highly Available)
25
+
- Low CPU-consuming
26
+
- Fast: A high-velocity communication bus
27
+
- High scalability
28
+
- Light-weight
29
+
- Supports wildcard-based subjects subscription
30
+
31
+
### Cons of NATS
32
+
33
+
- Fire and forget in the case of Core NATS but with JetStream it provides ‘at least once’ and ‘exactly once’ delivery guarantees
34
+
- No persistence in the Core NATS but it is possible with JetStream
35
+
36
+
---
37
+
38
+
We don't currently have a requirement for a messaging queue where order is important, nor do we rely on this information to be persistent. \
39
+
However, for optimum functionality we prefer a highly available deployment ensuring smooth operation of the event consumers.
40
+
41
+
We deploy a highly available Nats with Jetstream enabled, but with an in-memory storage configuration.
42
+
Here's how we configure via its helm chart:
43
+
44
+
```yaml
45
+
nats:
46
+
jetstream:
47
+
enabled: true
48
+
memStorage:
49
+
enabled: true
50
+
size: "5Mi"
51
+
fileStorage:
52
+
enabled: false
53
+
cluster:
54
+
enabled: true
55
+
replicas: 3
56
+
```
57
+
58
+
## Events
59
+
60
+
Here we list the events which we're currently publishing on the event bus.
0 commit comments