StackExchange / StackExchange/StackExchange.Redis

API proposal : pooled / leased connections as a secondary API

Open
#886 21 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

⚙️ area:connection 🪠 connection pooling
Dominant language
C#
Stars
6.2k
Forks
1.6k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Motivations:

  • provide safe access to blocking operations (BRPOPLPUSH, etc)
  • provide "pure" access to WATCH/MULTI/EXEC
  • we already expose the user to the risk of these operations via Execute; this would hopefully stop people doing dangerous things on the main connections

Counter-motivations:

  • Lua scripts are better solutions for most (but not all) scenarios that previously would have been WATCH/MULTI/EXEC

Note:

If implemented (needs consideration), the multiplexer would take care of the socket IO, but they would be stored separately and would not participate in the multiplexed command stream. This would be in addition to the regular API and would just work inside the existing context.

Questions:

  • what does this mean for cluster? is it assumed that all operations on a lease will participate on a single shard and will therefore be single-server?
  • how is primary/replica selected
  • what does the lease API look like - presumably using?
  • what happens when the pool is exhausted? is it an "await (async) an item from the pool, or timeout after x"?
  • where would it attach; IServer ? and if so, do we need a new GetServer mechanism that makes this painless?
  • how complex does the pool management need to be? just a max? is it enabled at all if not configured?
  • do timeouts apply on blocking operations? if so, how?

Timescales:

It won't be 2.0

Likelihood:

Thinking about it; it is tempting.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing Execute and IServer APIs, then consider how a separate leased-connection API would fit alongside the regular API. The open questions cover cluster behavior, primary/replica selection, lease syntax, pool exhaustion, configuration, and timeouts; done requires an agreed design for these concerns.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, redis
Domain
api, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.