WAF++ WAF++
Back to WAF++ Homepage

WAF-PERF-040 – Database Performance Baseline & Index Strategy

Beschreibung

Alle Produktionsdatenbanken MÜSSEN Performance Insights oder äquivalentes Monitoring aktiv haben. Slow-Query-Logging MUSS aktiviert sein mit einer definierten Schwelle (Standard: 1000ms). Eine Index-Strategie MUSS für alle Tabellen mit signifikanter Lese-/Schreiblast existieren. Performance-Baselines (P50/P95/P99 Ausführungszeiten) MÜSSEN für die Top-20-Queries dokumentiert sein.

Rationale

Fehlende Indizes auf hochfrequentierten Tabellen sind die häufigste einzelne Ursache für Datenbankperformance-Probleme. Ein Full Table Scan auf einer Tabelle mit 10 Millionen Zeilen kann die gesamte Datenbankkapazität sättigen und Cascading-Timeouts über den gesamten Anwendungsstack auslösen. Ohne Slow-Query-Log gibt es keine Möglichkeit, solche Probleme proaktiv zu identifizieren.

Bedrohungskontext

Risiko Beschreibung

Full Table Scans

Fehlende Indizes → Vollständige Tabellenscans → I/O-Sättigung und CPU-Spike.

Connection-Pool-Erschöpfung

Langsame Queries blockieren Verbindungen → Pool erschöpft → Neue Requests können nicht verbinden.

Query-Regression nach Schema-Änderung

Neuer Index für ein Feature entfernt den Query-Plan eines anderen Features – unbemerkt.

Kein Diagnostic-Zugang bei Incident

Performance Insights nicht aktiv → Incident kann nicht diagnostiziert werden.

Anforderung

  • Performance Insights MUSS auf allen Produktions-RDS/Aurora/Cloud SQL-Instanzen aktiv sein

  • Slow-Query-Log MUSS aktiv sein mit Schwelle ⇐ 1000ms

  • Index-Strategie MUSS für Tabellen mit > 1M Rows und hoher Query-Frequenz dokumentiert sein

  • Performance-Baseline (P50/P95/P99) MUSS für Top-20-Queries vorliegen

Implementierungsanleitung

  1. Performance Insights aktivieren: Bei RDS: performance_insights_enabled = true

  2. Slow-Query-Log konfigurieren: log_min_duration_statement = 1000 (PostgreSQL)

  3. Slow Queries analysieren: Wöchentlich pg_stat_statements / MySQL Slow Query Log reviewen

  4. Top-20-Queries identifizieren: Nach Gesamtausführungszeit sortiert; EXPLAIN ANALYZE ausführen

  5. Index-Strategie dokumentieren: docs/database/index-strategy.yml für jede Haupttabelle

  6. Fehlende Indizes anlegen: CREATE INDEX CONCURRENTLY für Online-Migration

  7. Connection Pooling: PgBouncer oder RDS Proxy für Connection-Pool-Management

Reifegrad-Abstufung

Level Bezeichnung Kriterien

1

Keine Analyse

Slow-Query-Log nicht aktiv; Datenbankperformance unbekannt; Indizes nur ad-hoc.

2

Slow Queries bekannt

Slow-Query-Log aktiv; Reviews nach Incidents; Primärschlüssel und einige FK-Indizes.

3

Baseline dokumentiert

Performance Insights aktiv; Index-Strategie dokumentiert; monatlicher Review.

4

Automatisierte Analyse

Automatische Slow-Query-Tickets; Regression-Tests im CI; Unused-Index-Cleanup.

5

Continuous Optimization

Query-SLOs; automatisches Tuning; DB-Version-Upgrades gegen Baseline getestet.

Terraform Checks

waf-perf-040.tf.aws.rds-performance-insights

Prüft: RDS-Instanzen müssen Performance Insights und Enhanced Monitoring aktiviert haben.

Compliant Non-Compliant
resource "aws_db_instance" "main" {
  identifier = "db-payment"
  engine     = "postgres"
  performance_insights_enabled = true
  monitoring_interval          = 60
  monitoring_role_arn          = aws_iam_role.rds_monitoring.arn
  enabled_cloudwatch_logs_exports = ["postgresql"]
  deletion_protection = true
}
resource "aws_db_instance" "main" {
  identifier = "db-payment"
  engine     = "postgres"
  # Kein Performance Insights
  # Kein Enhanced Monitoring
  # Keine CW-Log-Exports
  # WAF-PERF-040 Violation
}

Remediation: performance_insights_enabled = true, monitoring_interval = 60, enabled_cloudwatch_logs_exports = ["postgresql"] setzen.

Evidenz

Typ Pflicht Beschreibung

Config

✅ Pflicht

Performance-Insights-Konfiguration auf Produktionsdatenbanken (Screenshot oder Terraform).

Governance

✅ Pflicht

Index-Strategie-Dokument für hochfrequente Tabellen.

Process

Optional

Monatlicher Slow-Query-Review-Bericht mit Action Items.

Config

Optional

Query-Performance-Baseline (P50/P95/P99 für Top-20-Queries).

Regulatorisches Mapping

Framework Controls

ISO/IEC 25010:2011

8.3.2 – Performance efficiency; 8.3.2.1 – Time behaviour; 8.3.2.2 – Resource utilisation; 8.3.2.3 – Capacity

AWS Well-Architected Framework

Performance Efficiency Pillar – Selection; Performance Efficiency Pillar – Review; Performance Efficiency Pillar – Efficiency

Azure Well-Architected Framework

Performance – Performance monitoring; Performance – Load and stress testing; Performance – Auto-scaling

Google Cloud Architecture Framework

Performance – Performance design principles; Performance – Monitoring and debugging

TOGAF 10

ADM Phase B – Business architecture; ADM Phase C – Application architecture; ADM Phase D – Technology architecture

DORA

DORA 2024 – Technical practices; DORA 2024 – Performance monitoring

ISO/IEC 29119

4.4.3 – Test design techniques; 4.5.3 – Test execution; 5.3.3 – Test reporting

ISO/IEC 12207

8.2.2.3 – Design and development of software; 9.4.2 – Verification

ITIL 4

SVS – Service value system; DP – Design principle; OV – Operation value chain

BSI C5:2020

OPS-01 – Operational monitoring; OPS-02 – Operational control; OPS-03 – Operational capacity

CIS Controls v8

CIS 8 – Continuous Vulnerability Management; CIS 8.1 – Vulnerability scanning

NIST SP 800-53

RA-1 – Security assessment policy; RA-2 – Security assessment controls; RA-5 – Security assessments; RA-9 – External information system attacks

NIST CSF 2.0

DE.CM – Continuous monitoring; DE.AE – Anomaly detection; DE.DP – Data performance

FedRAMP

RA-2, RA-5, RA-9 (Moderate/High baseline)

SOC 2 Type II

CC6.1 – Logical access security software; CC7.1 – Infrastructure and software monitoring

TISAX

Information security – Performance monitoring

ANSSI SecNumCloud

Domain – Performance monitoring

BIO

BIO – Prestatiedoelstellingen

ENS High

op.exp.2 – Configuración de seguridad; op.exp.3 – Gestión de la configuración

UK NCSC CAF

B4 – System security; B5 – System performance

CMMC 2.0

RA.L2-3.8.1 – Automated monitoring

IRAP

ISM – Performance monitoring

CCCS PBMM

RA-2 – Security assessment controls; RA-5 – Security assessments

MAS TRM

Ch.5 – Technology risk governance

ISMAP

Performance monitoring and validation

FISC

Technical measures – Performance monitoring