The keycloak project ended with four open questions that design could not
settle. A two-VM lab was built to answer them by measurement, and this is
that material: 26 experiments, 125 raw command outputs, 22 browser captures.
Follows the import procedure in README.md.
source/ the originating repository verbatim — 78 documents, 28 SVGs,
8 manifests, plus .source-revision recording the commit
final/ the SSOT
document.md 729 lines written from the 29 experiment documents, not
concatenated: what was predicted, what was measured, and
where the measurement itself was wrong
evidence/raw 125 outputs, flattened to <experiment>__<file> because
the originals collided (01-baseline.txt appeared three
times) and the audit only globs the top level
evidence/meta one per raw file; command and exitCode are null and the
README says why rather than inventing them
evidence/browser 22 captures
assets/ three diagrams through techviz
.techviz/ their VizSpecs
A separate project rather than an addition to keycloak: the B-layer answers
that project's four questions, but the A, C and D layers are about cluster
failure, SSO and operations, and one document.md should hold one subject.
The four question records there can point here through 관계.
Recorded rather than papered over: only three of the 28 diagrams were
remade. The repository forbids hand-drawn SVG and forbids titles inside the
canvas; all 28 originals carry both, so converting them is redrawing, not
reformatting. They stay in source/ and the gap is written into the document.
verify-pipeline.py passes. audit-records.py reports no issues.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
59 lines
2.4 KiB
Markdown
59 lines
2.4 KiB
Markdown
---
|
|
kind: REFERENCE
|
|
slug: session-scoped-settings-outlive-the-transaction
|
|
title: 세션 스코프 설정은 풀로 돌아간 커넥션에 남는다
|
|
topic: transaction-deadline-and-pool
|
|
project: clean-architecture-backend-template
|
|
status: 게시 전
|
|
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
|
|
rootTreeNode: reference:session-scoped-settings-outlive-the-transaction
|
|
verifiedOn: # 이 기록은 이번 회차에 실행 확인을 하지 않았다
|
|
---
|
|
|
|
# 세션 스코프 설정은 풀로 돌아간 커넥션에 남는다
|
|
|
|
## 목적
|
|
|
|
한 트랜잭션을 위해 건 세션 설정이 커넥션과 함께 풀로 돌아가, 무관한 다음 작업에 적용되는 것을 막는다.
|
|
|
|
## 규칙
|
|
|
|
1. 세션 스코프와 트랜잭션 스코프를 구별한다
|
|
세션 스코프로 설정하면 커넥션이 살아 있는 동안 유지된다. 트랜잭션이 끝나도 사라지지 않는다.
|
|
|
|
2. 가능하면 로컬 스코프를 쓴다
|
|
트랜잭션 로컬로 설정하면 커밋이나 롤백과 함께 사라진다.
|
|
|
|
3. 로컬이 불가능하면 반납 전에 되돌린다
|
|
설정을 건 쪽이 그것을 지우는 책임을 갖는다. 다음 사용자가 지울 것이라고 가정하지 않는다.
|
|
|
|
4. 데이터베이스마다 방법이 다르다
|
|
같은 개념의 설정이라도 문법과 스코프가 다르므로 설정기를 데이터베이스별로 둔다.
|
|
|
|
5. 테넌트나 사용자 컨텍스트를 세션에 남기지 않는다
|
|
커넥션이 풀에서 재사용되면 다른 테넌트의 요청이 앞 요청의 컨텍스트를 물려받는다.
|
|
|
|
## 적용 조건
|
|
|
|
커넥션 풀을 쓰는 모든 데이터베이스 접근
|
|
|
|
로컬 타임아웃 검색 경로 역할 테넌트 컨텍스트 같은 세션 설정
|
|
|
|
## 예외
|
|
|
|
풀을 쓰지 않고 요청마다 새 커넥션을 여는 구성은 이 규칙의 대상이 아니다. 그 경우 다른 비용이 든다.
|
|
|
|
## 예시
|
|
|
|
로컬 타임아웃 설정기가 PostgreSQL 과 H2 로 나뉘어 있다. 설정 문법이 다르고 세션에 남는 방식도 다르기 때문이다.
|
|
|
|
멀티테넌시에서 테넌트 컨텍스트를 세션에 남기면 풀 재사용이 곧 테넌트 경계 위반이 된다.
|
|
|
|
## 관계
|
|
|
|
- **호출 예산에서 DB 로컬 타임아웃까지의 데드라인 전파**
|
|
로컬 타임아웃을 거는 지점이다.
|
|
- **connection-timeout이 5s 문자열로 출하되어 prod와 dev 배포가 전부 시작에 실패했다**
|
|
같은 설정 계층의 다른 함정이다.
|
|
|