Initial commit: Complete Software Architecture course with 11 modules
- Added comprehensive course structure with 11 modules - Included theoretical content, practical examples, and tasks - Multi-language code examples (Java, Rust, Node.js, Python) - Detailed analysis of architectural approaches and trade-offs - Complete caching strategies documentation - Architecture examples from real-world systems (Twitter, Netflix, Uber) - Structured navigation and learning path - Ready for educational use
This commit is contained in:
commit
15e744da49
107 files changed
+61762
No files matched your search
@@ -0,0 +1,80 @@
|
||||
# SLI/SLO/SLA
|
||||
|
||||
## Навигация
|
||||
- [🏠 Главная страница курса](../../../README.md)
|
||||
- [📚 Модуль 5](../README.md)
|
||||
|
||||
---
|
||||
|
||||
## SLI (Индикатор уровня сервиса)
|
||||
|
||||
**SLI** — метрика, которая измеряет качество сервиса.
|
||||
|
||||
### Примеры SLI:
|
||||
- **Availability**: `successful_requests / total_requests`
|
||||
- **Latency**: `requests_completed_within_threshold / total_requests`
|
||||
- **Throughput**: `successful_requests_per_second`
|
||||
|
||||
```java
|
||||
@Component
|
||||
public class SLICalculator {
|
||||
public double calculateAvailability(String service, Duration window) {
|
||||
Counter successfulRequests = Counter.builder("requests.successful")
|
||||
.tag("service", service)
|
||||
.register(meterRegistry);
|
||||
|
||||
Counter totalRequests = Counter.builder("requests.total")
|
||||
.tag("service", service)
|
||||
.register(meterRegistry);
|
||||
|
||||
double successful = successfulRequests.count();
|
||||
double total = totalRequests.count();
|
||||
|
||||
return total > 0 ? successful / total : 0.0;
|
||||
}
|
||||
|
||||
public double calculateLatency(String service, Duration threshold) {
|
||||
Timer requestTimer = Timer.builder("request.duration")
|
||||
.tag("service", service)
|
||||
.register(meterRegistry);
|
||||
|
||||
// логика расчета латентности
|
||||
return 0.95; // пример
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## SLO (Цель уровня сервиса)
|
||||
|
||||
**SLO** — целевое значение для SLI.
|
||||
|
||||
### Примеры SLO:
|
||||
- **Availability**: 99.9% uptime
|
||||
- **Latency**: 95% of requests < 200ms
|
||||
- **Error Rate**: < 0.1% errors
|
||||
|
||||
```java
|
||||
@Component
|
||||
public class SLOMonitor {
|
||||
private final Map<String, SLO> slos = Map.of(
|
||||
"availability", new SLO("availability", 0.999, "99.9% uptime"),
|
||||
"latency", new SLO("latency", 0.95, "95% < 200ms"),
|
||||
"error_rate", new SLO("error_rate", 0.001, "< 0.1% errors")
|
||||
);
|
||||
|
||||
public boolean checkSLO(String sloName, double currentValue) {
|
||||
SLO slo = slos.get(sloName);
|
||||
return currentValue >= slo.getTarget();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## SLA (Соглашение об уровне сервиса)
|
||||
|
||||
**SLA** — соглашение с клиентами о качестве сервиса.
|
||||
|
||||
### Компоненты SLA:
|
||||
- **Service Description** — описание сервиса
|
||||
- **Performance Metrics** — метрики производительности
|
||||
- **Availability Targets** — цели доступности
|
||||
- **Remediation** — меры по устранению нарушений
|
||||
Reference in new issue
Block a user