Skip to content

docs: add sticky sessions proposal - #904

Open
abdallahsamabd wants to merge 1 commit into
praxis-proxy:mainfrom
abdallahsamabd:proposal/108
Open

docs: add sticky sessions proposal#904
abdallahsamabd wants to merge 1 commit into
praxis-proxy:mainfrom
abdallahsamabd:proposal/108

Conversation

@abdallahsamabd

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds the What/Why proposal for Sticky Sessions / Session Affinity. This defines the problem space (lack of cookie-based persistence, no learn mode, no shared session mapping, no graceful failover) and motivates the feature with user stories covering browser clients, legacy apps, API clients, and multi-worker deployments.

Which issue(s) does this relate to?

Fixes #108

Checklist

  • Signed off all commits (git commit -s)
  • Tests added or updated
  • Documentation updated (if applicable)
  • make lint && make test passes locally

Does this introduce a breaking change?

No. This is a proposal document only — no code changes.

@abdallahsamabd
abdallahsamabd requested a review from a team August 3, 2026 15:11
@praxis-bot-app

praxis-bot-app Bot commented Aug 3, 2026

Copy link
Copy Markdown

Proposal validation failed:

  • docs/proposals/00108_sticky-sessions.md: missing discussion field in frontmatter
    See proposal process for requirements.

@abdallahsamabd abdallahsamabd changed the title docs(proposals): add sticky sessions proposal docs: add sticky sessions proposal Aug 3, 2026
@shaneutt shaneutt self-assigned this Aug 3, 2026
@shaneutt shaneutt added this to the v0.6.0 milestone Aug 3, 2026

@praxis-bot praxis-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Good proposal that clearly defines the problem space and motivates the feature well. The What/Why structure follows the template, the user stories are concrete, and the consistent-hashing limitations are well-enumerated.

The main gap is the relationship to proposal #99 (Stateful Proxy State Management), which explicitly lists sticky sessions as a feature driver and defines the storage patterns this proposal's shared mapping would need. The proposal should also address bounded-state requirements given the project's conventions around memory safety.

Severity Count
Large 2
Medium 2

Automated review by praxis-bot

Comment thread docs/proposals/00108_sticky-sessions.md Outdated
response (e.g. Set-Cookie: JSESSIONID) and
automatically build session-to-endpoint mapping
- Shared session-to-endpoint mapping: thread-safe,
cross-worker data structure

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Large] The shared session-to-endpoint mapping is exactly the "shared hot-path state" pattern defined in proposal #99 (Stateful Proxy State Management). That proposal is in proposed status and explicitly lists sticky sessions in its Feature Drivers table with the direction: "Typed session and task stores with TTLs and config-generation awareness."

Add a cross-reference to proposal #99 and clarify the relationship: does this proposal depend on #99's state model being accepted first, or does it intend to define its own storage approach independently? Without that context a reviewer cannot evaluate whether the shared mapping design will be consistent with the project-wide state strategy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added cross-reference to proposal #99 in the feature list (lines 41-45) and a dependency statement in Goals (lines 80-84) clarifying that this proposal depends on #99's state model for the storage layer

Express) work without modification.
- Provide a shared session-to-endpoint mapping visible
to all proxy workers so routing is consistent
regardless of which worker handles the request.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Large] The goals mention a shared mapping "visible to all proxy workers" but omit bounded-state requirements. The project's existing patterns require bounded state with explicit constraints: the per-IP rate limiter uses a 100K soft / 200K hard entry cap, and proposal #99 requires that "all hot-path state calls to have bounded timeouts and visible metrics."

Add goals for:

  • TTL or max-age on session-to-endpoint mappings (what happens to stale entries?)
  • Entry count bounds or eviction policy (what prevents unbounded memory growth under high session cardinality?)
  • Behavior on hot-reload (proposal #99 notes that pipeline reload resets local filter state -- session mappings would be lost if filter-owned)

These are What-level constraints, not How-level details, because they affect whether the feature is viable without external storage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added bounded-state goals: TTL-based expiry, configurable entry count cap with eviction policy, visible metrics, and explicit hot-reload behavior (lines 70-84)

Comment thread docs/proposals/00108_sticky-sessions.md Outdated
4. **No failover** — if the hashed endpoint is
unhealthy, the ring probes adjacent slots rather
than maintaining a stable re-pin for the session
lifetime.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] "No failover" is slightly misleading. The consistent-hash implementation does handle unhealthy endpoints: it probes adjacent ring slots and falls back to the hashed slot only when all endpoints are unhealthy (see ConsistentHash::select in filter/src/load_balancing/consistent_hash.rs).

The actual limitation is that the fallback is ephemeral and unstable: the probed-to endpoint is not persisted as a binding, so if the original endpoint recovers, the session silently moves back; and if topology changes, the probe path itself shifts. Suggest rephrasing to: "No stable failover -- when the hashed endpoint is unhealthy, the ring probes adjacent slots but does not persist the new binding, so sessions can bounce between endpoints across health transitions and topology changes."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rephrased to "No stable failover" acknowledges the ring probing but clarifies that the binding is not persisted, causing sessions to bounce across health transitions and topology changes.

Comment thread docs/proposals/00108_sticky-sessions.md Outdated
---
issue: https://github.com/praxis-proxy/praxis/issues/108
discussion:
- https://github.com/orgs/praxis-proxy/discussions/905

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] The discussion field uses a YAML list format, but the proposal template (docs/proposals/template.md) and existing proposals (e.g., #99) use a scalar value. Change to scalar format for consistency:

discussion: https://github.com/orgs/praxis-proxy/discussions/905

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Changed from YAML list to scalar format.

@abdallahsamabd
abdallahsamabd force-pushed the proposal/108 branch 2 times, most recently from d54e12e to a712d5a Compare August 3, 2026 19:54
@praxis-bot-app

praxis-bot-app Bot commented Aug 3, 2026

Copy link
Copy Markdown

Unsigned commits: a712d5a. Please sign your commits.

Signed-off-by: Abdallah Samara <abdallahsamabd@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Review

Development

Successfully merging this pull request may close these issues.

Sticky Sessions / Session Affinity

3 participants