vllm-project / vllm-project/aibrix

Refactor Redis backend selection to avoid hard-coded branching across the codebase

Open
#2,333 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
5.1k
Forks
694
Avg merge
1d 19h
Merged PRs (30d)
98

Description

### 🚀 Feature Description and Motivation

Enterprise users might like to swtich redis backends between two versions: standard redis.asyncio and internal customized redis backend, possibly use sync redis only without aysncio support.

Currently, there is no centralized backend selection feature. Any place that needs Redis-related functionality, such as metadata/app.py , storage/factory.py , and tests, will have to implement manual branch on redis related environments (REDIS_HOST for standard, enterprise backend might rely on other environment values) or import different implementations. This causes duplicated logic, duplicated interfaces, and duplicated tests, and makes it easy for behavior to drift between the two paths.

The current design violates code reuse and separation of concerns: application code and tests should depend on a shared abstraction or factory, not on backend-specific if/else branches. We should introduce a single reusable Redis client/store factory or adapter layer, so callers use one API and backend switching happens in one place only.

### Use Case

At bytedance, customized redis relies on REDIS_PSM instead of REDIS_HOST, and does not support asyncio. Existing implementation branch on each use cases of redis library, such as metadata/app.py, storage/factory.py, and redis related unit tests.

### Proposed Solution

Centralize the backend selection in one place and redis libraries: metadata/store.py, storage/redis.py only need to call client getter, which will own backend selection logic.

Contributor guide

Open the contributing guide

Research direction

Read the Redis branches and environment handling in metadata/app.py, storage/factory.py, metadata/store.py, and storage/redis.py, then inspect the Redis-related unit tests. Trace how REDIS_HOST and REDIS_PSM select implementations and identify the shared client getter boundary. Done means callers and tests use centralized backend selection without duplicated backend-specific branching.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, redis
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.