initial commit
This commit is contained in:
51
08-Słownik-K8s/NATS JetStream.md
Normal file
51
08-Słownik-K8s/NATS JetStream.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# NATS JetStream
|
||||
|
||||
#kubernetes #messaging #słownik
|
||||
|
||||
## Co to jest?
|
||||
|
||||
**NATS** to lekki, cloud-native system messaging. **JetStream** to warstwa persistence dodana do NATS, umożliwiająca **durable pub/sub** z replay, retention i consumer groups.
|
||||
|
||||
## NATS vs JetStream
|
||||
|
||||
| NATS Core | NATS JetStream |
|
||||
|-----------|----------------|
|
||||
| Fire-and-forget | Durable (zapisane na dysk) |
|
||||
| At-most-once | At-least-once delivery |
|
||||
| Brak replay | Replay od dowolnego punktu |
|
||||
| Brak consumer groups | Consumer groups + ack |
|
||||
| Ultra-fast | Szybki (trochę wolniejszy) |
|
||||
|
||||
## Porównanie z alternatywami
|
||||
|
||||
| System | Latency | Throughput | Complexity | Use case |
|
||||
|--------|---------|------------|------------|----------|
|
||||
| **NATS JetStream** | ~1ms | ~100K msg/s | **Niski** | Cloud-native, K8s |
|
||||
| Apache Kafka | ~5ms | ~1M msg/s | Wysoki | Big data, streaming |
|
||||
| RabbitMQ | ~3ms | ~50K msg/s | Średni | Enterprise messaging |
|
||||
| Redis Streams | ~1ms | ~200K msg/s | Niski | Caching + messaging |
|
||||
|
||||
## Kluczowe koncepty JetStream
|
||||
|
||||
| Koncept | Opis |
|
||||
|---------|------|
|
||||
| **Stream** | Named storage dla wiadomości (temat wildcard) |
|
||||
| **Consumer** | Subskrybent z cursor/offset tracking |
|
||||
| **Durable Consumer** | Consumer z persistence (survives restarts) |
|
||||
| **Ack** | Potwierdzenie przetworzenia wiadomości |
|
||||
| **Retention** | Limits (max age, max bytes) lub Interest-based |
|
||||
|
||||
## Użycie w Sympozium
|
||||
|
||||
NATS JetStream jest **centralnym event bus'em** Sympozium:
|
||||
|
||||
- **Stream**: `sympozium` z subjects `sympozium.>`
|
||||
- **Retention**: 24h max age
|
||||
- **Deployment**: [[StatefulSet]] w `sympozium-system`
|
||||
- **URL**: `nats://nats.sympozium-system.svc:4222`
|
||||
|
||||
Tematy: patrz [[NATS JetStream - Event Bus]]
|
||||
|
||||
---
|
||||
|
||||
Powiązane: [[NATS JetStream - Event Bus]] | [[Przepływ danych i IPC]] | [[StatefulSet]]
|
||||
Reference in New Issue
Block a user