Skip to content

feat: add CLIENT SETNAME/SETINFO support#2790

Open
nesty92 wants to merge 1 commit into
phpredis:developfrom
nesty92:develop
Open

feat: add CLIENT SETNAME/SETINFO support#2790
nesty92 wants to merge 1 commit into
phpredis:developfrom
nesty92:develop

Conversation

@nesty92

@nesty92 nesty92 commented Dec 16, 2025

Copy link
Copy Markdown

While it's possible to set the client name with the current api from php, it will set the client name on each execution from the php side, moving it to the lib in self could make it more reliable and easy to use.

A new status for the connections, REUSED will help to track the lifecycle of the connection, the new HELLO could be useful to implement RESP 3 or Availability Zone affinity for Valkey

CLIENT SETINFO follows Redis best practices for client libraries, providing library name and version metadata for monitoring.

@michael-grunder

Copy link
Copy Markdown
Member

Thanks! I like the idea in general.

The only concerns I have are:

  1. Backward compatibility: How does it impact users connecting to ancient versions of Redis.
  2. Performance: If a user's workload consists of very short lived ephemeral connections, the added round trips could impact throughput.

Improve connection visibility and debugging. Setting client names
allows operators to identify which application a connection belongs
to using CLIENT LIST.

CLIENT SETINFO follows Redis best practices for client libraries,
providing library name and version metadata for monitoring.

Signed-off-by: Ernesto Alejandro Santana Hidalgo <ernesto.alejandrosantana@gmail.com>
@nesty92

nesty92 commented Dec 18, 2025

Copy link
Copy Markdown
Author

Hi @michael-grunder, thanks for the feedback, having this feature for short time connections is not useful so we could skip those. Let me know your thoughts about it

+-----------------------+
|    START HANDSHAKE    |
+-----------+-----------+
            |
            v
  Is Connection Persistent?
            |
      NO ---+--- YES
      |          |
      |          v
      |    +-----------------------------------------------+
      |    |  Build & Send "HELLO 2" Command               |
      |    |  (Includes AUTH & SETNAME as arguments)       |
      |    +-----------------------+-----------------------+
      |                            |
      |                            v
      |                  Response is okay?
      |                            |
      |                NO ---------+--------- YES
      |                |                      |
      |                v                      v
      |     +---------------------+    +---------------------+
      |     |      FALLBACK       |    |      REDIS 6+       |
      |-> |   (Legacy Logic)    |    |   (Modern Logic)    |
            +----------+----------+    +----------+----------+
                       |                      |
                       v                      v
                Has Password?          Parse Server Info
                 /           \         (server, version)
               NO             YES             |
               |               |              |
               |               v              |
               |        Send AUTH cmd         |
   SUCCESS <---+-- OK? <-------+              |
      ^        |               |              |
      |        |               NO --> FAILURE |
      |        |                              |
      |        v                              |
      |   Has Client Name?                    |
      |    /            \                     |
      |  NO              YES                  |
      |  |                |                   |
      |  |                v                   |
      +--+        Send CLIENT SETNAME         |
         |                |                   |
         |                v                   |
         +------- OK? <---+                   |
                   /       \                  |
             NO         YES                   |
               |             \                |
               |              \               v
           FAILURE                  SUCCESS

@michael-grunder

Copy link
Copy Markdown
Member

Yeah a lot of that makes sense. Persistent connections can be expected to live longer.

The absolute safest choice would be to gate it behind an option, but I'll play around with it over the weekend.

@nesty92

nesty92 commented Jan 8, 2026

Copy link
Copy Markdown
Author

Hi @michael-grunder any news on this one??

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.

2 participants