Performance/scalability issues on LegalTag Query endpoint
Newly introduced /legaltags:query
API may have scalability & performance issues with current implementation. It could become a blocker for it's wider adoption and production usage.
Query API fetches all the LegalTag in memory and iterates over each LegalTag to match query criteria. It utilizes internal implementation of GET /legaltags API (list legal tag API). We are already seeing out of memory issue with list legal tag API.
If an environments have few data partitions with few thousands LegalTags; on a moderate Query API usage, we will have high memory usage and potentially OOM errors. Both of these issue will impact all APIs on Legal service, as memory is shared resource & Kubernetes pods will crash & restart on OOM errors.