Skip to content

Allow SessionStore to return Nothing to skip Set-Cookie#17

Open
mpscholten wants to merge 1 commit into
singpolyma:masterfrom
mpscholten:lazy-session-store
Open

Allow SessionStore to return Nothing to skip Set-Cookie#17
mpscholten wants to merge 1 commit into
singpolyma:masterfrom
mpscholten:lazy-session-store

Conversation

@mpscholten
Copy link
Copy Markdown

@mpscholten mpscholten commented Feb 11, 2026

When getNewCookie returns Nothing, withSession skips the Set-Cookie header.
This enables session stores to signal "no change" and avoid unnecessary
cookie updates on every response.

Benchmark Results

Tested with a minimal WAI app using withSession+clientsessionStore and a handler that never accesses the session (the common case for most routes):

Scenario Before After Improvement
No cookie (new visitor) 43,858 req/s, p50=2.2ms 128,990 req/s, p50=0.4ms 2.9x throughput, 5.5x lower p50
With cookie (read-only) 39,533 req/s, p50=2.5ms 123,160 req/s, p50=0.4ms 3.1x throughput, 6.3x lower p50

See: #15

When getNewCookie returns Nothing, withSession skips the Set-Cookie header.
This enables session stores to signal "no change" and avoid unnecessary
cookie updates on every response.

See: singpolyma#15
mpscholten added a commit to digitallyinduced/ihp that referenced this pull request Feb 11, 2026
Replace local patch files with fetchpatch from upstream PRs:
- singpolyma/wai-session#17
- singpolyma/wai-session-clientsession#5

Co-Authored-By: Claude Opus 4.6 <[email protected]>
mpscholten added a commit to digitallyinduced/ihp that referenced this pull request Feb 11, 2026
Replace local patch files with fetchpatch from upstream PRs:
- singpolyma/wai-session#17
- singpolyma/wai-session-clientsession#5

Co-Authored-By: Claude Opus 4.6 <[email protected]>
mpscholten added a commit to digitallyinduced/ihp that referenced this pull request Feb 11, 2026
Replace local patch files with fetchpatch from upstream PRs:
- singpolyma/wai-session#17
- singpolyma/wai-session-clientsession#5

Co-Authored-By: Claude Opus 4.6 <[email protected]>
mpscholten added a commit to digitallyinduced/ihp that referenced this pull request Feb 11, 2026
Replace local patch files with fetchpatch from upstream PRs:
- singpolyma/wai-session#17
- singpolyma/wai-session-clientsession#5

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@mpscholten
Copy link
Copy Markdown
Author

@singpolyma any thoughts on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant