Skip to content

KeyValue.keys() with filters fetches all keys from server causing performance issues #768

@TarasLykhenko

Description

@TarasLykhenko

Observed behavior

When using the keys() method with filters on a KeyValue store containing a large number of keys (thousands or more), the method fetches all keys from the server and filters them client-side using substring matching. This creates significant performance problems and server load.

Expected behavior

The KeyValue keys() method should perform server-side filtering to minimize network traffic and server load, similar to how the Go client implements this functionality.

Server and client version

  • NATS Server: 2.12.1
  • nats-py: current main branch
  • Python: 3.11+

Host environment

No response

Steps to reproduce

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectSuspected defect such as a bug or regression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions