Files
document-haness/docs/keycloak-session-store/final/assets/a3-commit-to-disk-gap/a3-commit-to-disk-gap.alt.md
T

23 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 200 과 디스크 사이의 빈 구간
## Alternative text
클라이언트가 200 을 받은 뒤에도 WAL 이 아직 디스크에 닿지 않은 구간이 남아 있는 구성.
## Long description
Keycloak 은 트랜잭션마다 SET LOCAL synchronous_commit TO OFF 를 건다. PostgreSQL 은 COMMIT 을 WAL 디스크 기록을 기다리지 않고 즉시 반환하고, 클라이언트는 200 과 토큰을 받는다. 실측된 wal_writer_delay 는 200ms 이며 그 사이에 프로세스가 죽으면 그만큼이 사라진다. 153건 중 4건이 그렇게 유실됐다. 버그가 아니라 의도된 설계이고 그 대가를 숫자로 확인한 것이다.
## Elements and evidence
- **클라이언트** (actor): 200 과 토큰을 받는다. Evidence: L513L518.
- **Keycloak** (service): 트랜잭션마다 synchronous_commit 을 끈다. Evidence: L516L518.
- **PostgreSQL** (datastore): COMMIT 을 즉시 반환한다. WAL 은 아직 메모리에 있다. Evidence: L516L518.
- **디스크의 WAL** (datastore): 여기 닿아야 살아남는다. Evidence: L513L518.
## Relationships
- **클라이언트 → Keycloak:** 로그인 요청. Evidence: L513L516.
- **Keycloak → PostgreSQL:** 세션 INSERT · COMMIT. Evidence: L516L518.
- **PostgreSQL → 디스크의 WAL:** 지연된 WAL 기록. Evidence: L516L518.