29장. Performance Schema Triage
장애 시작에는 추측보다 snapshot을 남긴다. deployment, error rate, p95, Threads_running, connection, redo, disk, replication lag를 시각과 함께 고정한다. slow log를 갑자기 전체 query에 켜서 I/O를 더하지 않는다.
select th.PROCESSLIST_ID,th.PROCESSLIST_USER,th.PROCESSLIST_HOST,
th.PROCESSLIST_TIME,th.PROCESSLIST_STATE,left(th.PROCESSLIST_INFO,160)
from performance_schema.threads th
where th.TYPE='FOREGROUND' and th.PROCESSLIST_ID is not null
order by th.PROCESSLIST_TIME desc;
select * from sys.innodb_lock_waits order by wait_age_secs desc;
digest summary에서 count, total latency, avg latency, rows examined/sent, tmp disk table를 함께 본다. 평균은 괜찮지만 tail이 큰 query를 놓치지 않도록 application metric과 연결한다. sample SQL의 parameter·data skew를 보존하되 PII는 마스킹한다.
완화는 feature flag, traffic shaping, query cancel, blocker session 정리, pool 제한 순서로 영향을 비교한다. KILL은 transaction rollback과 client retry를 발생시킨다. transaction outcome이 불명하면 무조건 재실행하지 말고 idempotency key로 결과를 조회한다.