docs(keycloak-session-store): import the session-storage lab as a new project

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>
This commit is contained in:
DongHyeonka
2026-09-04 22:51:59 +09:00
co-authored by Claude Opus 5
parent 43bccd08a8
commit b2963105a8
5017 changed files with 372751 additions and 4943 deletions
@@ -0,0 +1,23 @@
# 세션 공유가 실제로 지나는 경로
## Alternative text
keycloak-0 과 keycloak-1 이 각자 캐시를 갖고 PostgreSQL 을 함께 읽는 구성. 두 캐시 사이에는 세션 복제 경로가 없다.
## Long description
keycloak-0 과 keycloak-1 은 JGROUPS_PING 테이블을 통해 서로를 발견하고 클러스터 뷰를 형성한다. 그러나 sessions 캐시의 엔트리는 노드 사이로 복제되지 않으며, 각 노드는 자기가 처리한 로그인만 캐시한다. 노드 A 로 로그인한 세션을 노드 B 가 아는 이유는 노드 B 가 PostgreSQL 의 OFFLINE_USER_SESSION 을 직접 읽기 때문이고, 이는 반대편 노드가 날린 SQL 을 문장 로깅으로 잡아 확인했다.
## Elements and evidence
- **keycloak-0** (service): 로그인을 처리하고 자기 sessions 캐시에만 엔트리를 남긴다. Evidence: L49L51.
- **PostgreSQL** (datastore): OFFLINE_USER_SESSION 에 세션 행을 보관한다. 두 노드가 같은 행을 본다. Evidence: L48L52.
- **keycloak-1** (service): 다른 노드가 만든 세션을 캐시로 받지 않고 데이터베이스에서 읽는다. Evidence: L48L51.
- **JGROUPS_PING** (datastore): 노드가 서로를 발견하는 자리. 여기 등록되어 있다는 것과 세션이 복제된다는 것은 다른 사건이다. Evidence: L44L46.
## Relationships
- **keycloak-0 → JGROUPS_PING:** 멤버 등록. Evidence: L44L45.
- **keycloak-0 → PostgreSQL:** 세션 INSERT. Evidence: L49L52.
- **keycloak-1 → JGROUPS_PING:** 멤버 등록. Evidence: L44L45.
- **keycloak-1 → PostgreSQL:** 세션 SELECT. Evidence: L48L50.
@@ -0,0 +1,19 @@
# 세션 공유가 실제로 지나는 경로
# Question: 두 Keycloak 노드가 같은 세션을 아는 것은 무엇 때문인가
direction: right
n0: "keycloak-0" {
shape: rectangle
}
n1: "PostgreSQL" {
shape: cylinder
}
n2: "keycloak-1" {
shape: rectangle
}
n3: "JGROUPS_PING" {
shape: cylinder
}
n0 -> n1: "세션 INSERT"
n2 -> n1: "세션 SELECT"
n0 -> n3: "멤버 등록"
n2 -> n3: "멤버 등록"
@@ -0,0 +1,13 @@
digraph techviz {
graph [rankdir=LR, splines=ortho, nodesep=0.55, ranksep=0.85];
node [fontname=Helvetica, fontsize=11, margin="0.18,0.12", style="rounded,filled", fillcolor=white, color="#2d4357", penwidth=1.5];
edge [fontname=Helvetica, fontsize=10, color="#364b5f", penwidth=1.4, arrowsize=0.75];
n0 [label="keycloak-0", shape=box, style="rounded,filled"];
n1 [label="PostgreSQL", shape=cylinder, style="rounded,filled"];
n2 [label="keycloak-1", shape=box, style="rounded,filled"];
n3 [label="JGROUPS_PING", shape=cylinder, style="rounded,filled"];
n0 -> n1 [label="세션 INSERT", style=solid];
n2 -> n1 [label="세션 SELECT", style=solid];
n0 -> n3 [label="멤버 등록", style=solid];
n2 -> n3 [label="멤버 등록", style=solid];
}
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2026-07-23T00:00:00.000Z" agent="techviz-harness" version="24.7.17" type="device">
<diagram id="session-sharing-path" name="세션 공유가 실제로 지나는 경로">
<mxGraphModel dx="680" dy="364" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="n_keycloak-0" value="keycloak-0&lt;br/&gt;자기가 처리한 로그인만 캐시" tooltip="로그인을 처리하고 자기 sessions 캐시에만 엔트리를 남긴다. | Evidence: L49-L51" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;strokeColor=#2563eb;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="92.5" y="82.5" width="150.0" height="71.0" as="geometry"/>
</mxCell>
<mxCell id="n_keycloak-1" value="keycloak-1&lt;br/&gt;refresh 요청을 받으면 DB 를 조회" tooltip="다른 노드가 만든 세션을 캐시로 받지 않고 데이터베이스에서 읽는다. | Evidence: L48-L51" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;strokeColor=#2563eb;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="70.0" y="225.5" width="195.0" height="71.0" as="geometry"/>
</mxCell>
<mxCell id="n_jgroups-ping" value="JGROUPS_PING" tooltip="노드가 서로를 발견하는 자리. 여기 등록되어 있다는 것과 세션이 복제된다는 것은 다른 사건이다. | Evidence: L44-L46" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;shape=cylinder3;boundedLbl=1;backgroundOutline=1;fillColor=#eef6fb;strokeColor=#9ca3af;fillColor=#f9fafb;" vertex="1" parent="1">
<mxGeometry x="454.5" y="60.0" width="150.0" height="90.0" as="geometry"/>
</mxCell>
<mxCell id="n_postgres" value="PostgreSQL&lt;br/&gt;offline_flag=&#x27;0&#x27; 이 온라인 세션" tooltip="OFFLINE_USER_SESSION 에 세션 행을 보관한다. 두 노드가 같은 행을 본다. | Evidence: L48-L52" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;shape=cylinder3;boundedLbl=1;backgroundOutline=1;fillColor=#eef6fb;strokeColor=#2563eb;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="425.0" y="222.0" width="209.0" height="97.0" as="geometry"/>
</mxCell>
<mxCell id="e_k0-discovery" value="멤버 등록" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_keycloak-0" target="n_jgroups-ping">
<mxGeometry relative="1" as="geometry">
<mxPoint x="372.5" y="102.5" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="e_k0-writes" value="세션 INSERT" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_keycloak-0" target="n_postgres">
<mxGeometry relative="1" as="geometry">
<mxPoint x="357.8" y="194.2" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="e_k1-discovery" value="멤버 등록" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_keycloak-1" target="n_jgroups-ping">
<mxGeometry relative="1" as="geometry">
<mxPoint x="383.8" y="183.0" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="e_k1-reads" value="세션 SELECT" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_keycloak-1" target="n_postgres">
<mxGeometry relative="1" as="geometry">
<mxPoint x="369.0" y="274.8" as="offset"/>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
@@ -0,0 +1,685 @@
{
"type": "excalidraw",
"version": 2,
"source": "techviz-harness",
"elements": [
{
"id": "edge-k0-discovery",
"type": "arrow",
"x": 242.5,
"y": 96.0,
"width": 212.0,
"height": 13.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 584024925,
"version": 1,
"versionNonce": 1230381351,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
13.0
],
[
106.0,
13.0
],
[
106.0,
0.0
],
[
212.0,
0.0
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-keycloak-0",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-jgroups-ping",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-k0-discovery",
"type": "text",
"x": 327.5,
"y": 90.5,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 239076698,
"version": 1,
"versionNonce": 442745641,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "멤버 등록",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "멤버 등록",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "edge-k0-writes",
"type": "arrow",
"x": 242.5,
"y": 127.0,
"width": 182.5,
"height": 134.5,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 567703682,
"version": 1,
"versionNonce": 1423801697,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
0.0
],
[
91.25,
0.0
],
[
91.25,
134.5
],
[
182.5,
134.5
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-keycloak-0",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-postgres",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-k0-writes",
"type": "text",
"x": 312.75,
"y": 182.25,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1833086279,
"version": 1,
"versionNonce": 1211439496,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "세션 INSERT",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "세션 INSERT",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "edge-k1-discovery",
"type": "arrow",
"x": 265.0,
"y": 114.0,
"width": 189.5,
"height": 138.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 249138565,
"version": 1,
"versionNonce": 1103409032,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
138.0
],
[
94.75,
138.0
],
[
94.75,
0.0
],
[
189.5,
0.0
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-keycloak-1",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-jgroups-ping",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-k1-discovery",
"type": "text",
"x": 338.75,
"y": 171.0,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 693543637,
"version": 1,
"versionNonce": 134865854,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "멤버 등록",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "멤버 등록",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "edge-k1-reads",
"type": "arrow",
"x": 265.0,
"y": 270.0,
"width": 160.0,
"height": 9.5,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 1249142507,
"version": 1,
"versionNonce": 1362277348,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
0.0
],
[
80.0,
0.0
],
[
80.0,
9.5
],
[
160.0,
9.5
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-keycloak-1",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-postgres",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-k1-reads",
"type": "text",
"x": 324.0,
"y": 262.75,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1330903131,
"version": 1,
"versionNonce": 222775751,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "세션 SELECT",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "세션 SELECT",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-keycloak-0",
"type": "rectangle",
"x": 92.5,
"y": 82.5,
"width": 150.0,
"height": 71.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 969396610,
"version": 1,
"versionNonce": 1478355734,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-keycloak-0",
"type": "text",
"x": 102.5,
"y": 92.5,
"width": 130.0,
"height": 51.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 293436436,
"version": 1,
"versionNonce": 1829861746,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "keycloak-0\n자기가 처리한 로그인만 캐시",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "keycloak-0\n자기가 처리한 로그인만 캐시",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-keycloak-1",
"type": "rectangle",
"x": 70.0,
"y": 225.5,
"width": 195.0,
"height": 71.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1492679290,
"version": 1,
"versionNonce": 684109252,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-keycloak-1",
"type": "text",
"x": 80.0,
"y": 235.5,
"width": 175.0,
"height": 51.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 186685213,
"version": 1,
"versionNonce": 935977296,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "keycloak-1\nrefresh 요청을 받으면 DB 를 조회",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "keycloak-1\nrefresh 요청을 받으면 DB 를 조회",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-jgroups-ping",
"type": "rectangle",
"x": 454.5,
"y": 60.0,
"width": 150.0,
"height": 90.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#e7f5ff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1691553665,
"version": 1,
"versionNonce": 657056607,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-jgroups-ping",
"type": "text",
"x": 464.5,
"y": 70.0,
"width": 130.0,
"height": 70.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 593986141,
"version": 1,
"versionNonce": 116663944,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "JGROUPS_PING",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "JGROUPS_PING",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-postgres",
"type": "rectangle",
"x": 425.0,
"y": 222.0,
"width": 209.0,
"height": 97.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#e7f5ff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1035759464,
"version": 1,
"versionNonce": 1511157596,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-postgres",
"type": "text",
"x": 435.0,
"y": 232.0,
"width": 189.0,
"height": 77.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1404040862,
"version": 1,
"versionNonce": 1598470501,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "PostgreSQL\noffline_flag='0' 이 온라인 세션",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "PostgreSQL\noffline_flag='0' 이 온라인 세션",
"autoResize": true,
"lineHeight": 1.25
}
],
"appState": {
"gridSize": 10,
"viewBackgroundColor": "#ffffff",
"currentItemFontFamily": 5
},
"files": {}
}
@@ -0,0 +1,32 @@
{
"harness_version": "0.2.0",
"spec_id": "session-sharing-path",
"spec_version": "1.1",
"spec_sha256": "622b6917edfc97cfbbbeea476bac0bceab339d4734549895d8acd721284f0a42",
"source_context": {
"document": "docs/keycloak-session-store/final/document.md",
"document_sha256": "609353e10bfd37a9bbb6a79ecf2a32f3d3c02d5d161879a14ad4713e49e7e5e8",
"anchor": {
"kind": "heading",
"value": "그런데 첫 실험에서 전제가 무너졌다",
"line": 33
}
},
"outputs": [
"session-sharing-path.svg",
"session-sharing-path.mmd",
"session-sharing-path.d2",
"session-sharing-path.dot",
"session-sharing-path.drawio",
"session-sharing-path.excalidraw",
"session-sharing-path.alt.md"
],
"lint_issue_count": 1,
"assumption_count": 0,
"assumptions_allowed": false,
"composition_profile": "component-flow",
"reference_ids": [
"payment-event-flow"
],
"diagram_only": true
}
@@ -0,0 +1,11 @@
%% 세션 공유가 실제로 지나는 경로
%% question: 두 Keycloak 노드가 같은 세션을 아는 것은 무엇 때문인가
flowchart LR
n0["keycloak-0"]
n1[("PostgreSQL")]
n2["keycloak-1"]
n3[("JGROUPS_PING")]
n0 -->|"세션 INSERT"| n1
n2 -->|"세션 SELECT"| n1
n0 -->|"멤버 등록"| n3
n2 -->|"멤버 등록"| n3
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="680" height="364" viewBox="0 0 680 364" role="img" aria-labelledby="diagram-title diagram-description">
<title id="diagram-title">세션 공유가 실제로 지나는 경로</title>
<desc id="diagram-description">keycloak-0 과 keycloak-1 은 JGROUPS_PING 테이블을 통해 서로를 발견하고 클러스터 뷰를 형성한다. 그러나 sessions 캐시의 엔트리는 노드 사이로 복제되지 않으며, 각 노드는 자기가 처리한 로그인만 캐시한다. 노드 A 로 로그인한 세션을 노드 B 가 아는 이유는 노드 B 가 PostgreSQL 의 OFFLINE_USER_SESSION 을 직접 읽기 때문이고, 이는 반대편 노드가 날린 SQL 을 문장 로깅으로 잡아 확인했다.</desc>
<metadata>{&quot;techviz&quot;:{&quot;spec_version&quot;:&quot;1.1&quot;,&quot;id&quot;:&quot;session-sharing-path&quot;,&quot;profile&quot;:&quot;component-flow&quot;},&quot;source_context&quot;:{&quot;document&quot;:&quot;docs/keycloak-session-store/final/document.md&quot;,&quot;document_sha256&quot;:&quot;609353e10bfd37a9bbb6a79ecf2a32f3d3c02d5d161879a14ad4713e49e7e5e8&quot;,&quot;anchor&quot;:{&quot;kind&quot;:&quot;heading&quot;,&quot;value&quot;:&quot;그런데 첫 실험에서 전제가 무너졌다&quot;,&quot;line&quot;:33}},&quot;evidence_policy&quot;:&quot;Each factual element cites source lines or is marked assumption.&quot;,&quot;diagram_only&quot;:true}</metadata>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z" />
</marker>
<style>
:root { color-scheme: light; }
text { font-family: Inter, Pretendard, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; fill: #111827; }
.canvas { fill: #ffffff; }
.group-box { fill: #ffffff; stroke: #9ca3af; stroke-width: 1.4; stroke-dasharray: 7 5; }
.group-label-bg { fill: #ffffff; }
.group-label { font-size: 13px; font-weight: 650; fill: #374151; }
.edge { fill: none; stroke: #374151; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; marker-end: url(#arrow); }
.edge.style-dashed, .edge.semantic-dashed, .edge.assumption { stroke-dasharray: 7 5; }
.edge.style-dotted { stroke-dasharray: 2 5; }
.edge.emphasis-primary { stroke: #2563eb; stroke-width: 2.2; }
.edge.emphasis-muted { stroke: #9ca3af; }
.edge.emphasis-warning, .edge.kind-failure, .edge.kind-error { stroke: #dc2626; stroke-width: 2.2; }
.edge-label-bg { fill: #ffffff; }
.edge-label { font-size: 12px; font-weight: 560; text-anchor: middle; }
.node-shape { fill: #ffffff; stroke: #4b5563; stroke-width: 1.7; }
.node-shape.emphasis-primary { stroke: #2563eb; stroke-width: 2.2; }
.node-shape.emphasis-muted { stroke: #9ca3af; fill: #f9fafb; }
.node-shape.emphasis-warning { stroke: #d97706; stroke-width: 2; fill: #fffdf5; }
.node-shape.kind-database, .node-shape.kind-datastore, .node-shape.kind-storage { fill: #f8fafc; }
.node-shape.kind-queue, .node-shape.kind-event, .node-shape.kind-topic { fill: #fafafa; }
.node-shape.assumption { stroke-dasharray: 4 4; }
.storage-bottom, .controller-divider { fill: none; stroke: #4b5563; stroke-width: 1.4; }
.controller-led { fill: #4b5563; }
.actor-symbol { fill: none; stroke: #4b5563; stroke-width: 1.8; stroke-linecap: round; }
.actor-symbol.emphasis-primary { stroke: #2563eb; stroke-width: 2.2; }
.node-label { font-size: 14px; font-weight: 650; text-anchor: middle; }
.node-role { font-size: 10px; letter-spacing: 0.04em; text-anchor: middle; fill: #6b7280; }
.node-detail-divider { stroke: #d1d5db; stroke-width: 1; }
.node-detail { font-size: 11px; fill: #374151; }
.assumption-badge { font-size: 9px; font-weight: 700; fill: #92400e; }
.failure-mark { stroke: #dc2626; stroke-width: 4; stroke-linecap: round; }
.lifeline { stroke: #9ca3af; stroke-width: 1.2; stroke-dasharray: 5 5; }
.timeline-axis { stroke: #374151; stroke-width: 1.8; marker-end: url(#arrow); }
.timeline-stem { stroke: #6b7280; stroke-width: 1.3; }
.timeline-marker { fill: #ffffff; stroke: #374151; stroke-width: 1.7; }
.timeline-marker.primary { fill: #2563eb; stroke: #2563eb; }
.timeline-marker.warning { fill: #dc2626; stroke: #dc2626; }
.timeline-label { font-size: 13px; font-weight: 650; text-anchor: middle; }
.timeline-detail { font-size: 11px; fill: #4b5563; text-anchor: middle; }
</style>
</defs>
<rect class="canvas" width="680" height="364" />
<polyline class="edge kind-write style-solid emphasis-normal" points="242.5,109.0 348.5,109.0 348.5,96.0 454.5,96.0" data-evidence="44-45" />
<rect class="edge-label-bg" x="346.8" y="88.5" width="51.5" height="22" rx="3" />
<text class="edge-label" x="372.5" y="103.5">멤버 등록</text>
<polyline class="edge kind-write style-solid emphasis-normal" points="242.5,127.0 333.8,127.0 333.8,261.5 425.0,261.5" data-evidence="49-52" />
<rect class="edge-label-bg" x="318.6" y="180.2" width="78.3" height="22" rx="3" />
<text class="edge-label" x="357.8" y="195.2">세션 INSERT</text>
<polyline class="edge kind-write style-solid emphasis-normal" points="265.0,252.0 359.8,252.0 359.8,114.0 454.5,114.0" data-evidence="44-45" />
<rect class="edge-label-bg" x="358.0" y="169.0" width="51.5" height="22" rx="3" />
<text class="edge-label" x="383.8" y="184.0">멤버 등록</text>
<polyline class="edge kind-read style-solid emphasis-normal" points="265.0,270.0 345.0,270.0 345.0,279.5 425.0,279.5" data-evidence="48-50" />
<rect class="edge-label-bg" x="329.9" y="260.8" width="78.3" height="22" rx="3" />
<text class="edge-label" x="369.0" y="275.8">세션 SELECT</text>
<g id="node-keycloak-0">
<rect class="node-shape kind-service emphasis-primary role-source" data-evidence="49-51" x="92.5" y="82.5" width="150.0" height="71.0" rx="7" />
<text class="node-label" x="167.5" y="109.5">keycloak-0</text>
<line class="node-detail-divider" x1="106.5" y1="130.5" x2="228.5" y2="130.5" />
<text class="node-detail" x="108.5" y="147.5">자기가 처리한 로그인만 캐시</text>
</g>
<g id="node-keycloak-1">
<rect class="node-shape kind-service emphasis-primary role-target" data-evidence="48-51" x="70.0" y="225.5" width="195.0" height="71.0" rx="7" />
<text class="node-label" x="167.5" y="252.5">keycloak-1</text>
<line class="node-detail-divider" x1="84.0" y1="273.5" x2="251.0" y2="273.5" />
<text class="node-detail" x="86.0" y="290.5">refresh 요청을 받으면 DB 를 조회</text>
</g>
<g id="node-jgroups-ping">
<rect class="node-shape kind-datastore emphasis-muted role-support" data-evidence="44-46" x="454.5" y="73.0" width="150.0" height="64.0" /><ellipse class="node-shape kind-datastore emphasis-muted role-support" cx="529.5" cy="73.0" rx="75.0" ry="13.0" /><path class="storage-bottom" d="M 454.5 137.0 A 75.0 13.0 0 0 0 604.5 137.0" />
<text class="node-label" x="529.5" y="103.0">JGROUPS_PING</text>
</g>
<g id="node-postgres">
<rect class="node-shape kind-datastore emphasis-primary role-store" data-evidence="48-52" x="425.0" y="235.0" width="209.0" height="71.0" /><ellipse class="node-shape kind-datastore emphasis-primary role-store" cx="529.5" cy="235.0" rx="104.5" ry="13.0" /><path class="storage-bottom" d="M 425.0 306.0 A 104.5 13.0 0 0 0 634.0 306.0" />
<text class="node-label" x="529.5" y="262.0">PostgreSQL</text>
<line class="node-detail-divider" x1="439.0" y1="283.0" x2="620.0" y2="283.0" />
<text class="node-detail" x="441.0" y="300.0">offline_flag=&#x27;0&#x27; 이 온라인 세션</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.5 KiB