#community-help

Slow Query Performance in Typesense Server

TLDR Hariharan experienced slow queries in the typesense server on Kubernetes. Kishore Nallan suggested reducing fields and grouping them. The issue was caused by using scoped keys with user-based filters, and a faster output was achieved with an admin key.

Powered by Struct AI
7
9mo
Solved
Join the chat
Mar 10, 2023 (9 months ago)
Hariharan
Photo of md5-18c41204e6fd9bb8436d758a90a0e5ef
Hariharan
05:49 AM
Hi! I deployed the typesense server in kubernetes. Currently this instance having around 3 million records with 32 fields in schema. When we search data it takes around 3 seconds to return the output. We hosted typesense in separate node with 32gb Ram and 100gb disk space. We communicate with this server using application load balancer. Can you please let me know what could be the reason for performance lag?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:20 AM
Have you tried running the query directly against Typesense without using the LB? Also how many fields are you querying? All 32 fields?
Hariharan
Photo of md5-18c41204e6fd9bb8436d758a90a0e5ef
Hariharan
07:09 AM
Hi...when we run the query in server, we see getting result in less than 1 sec. We are querying around 20 fields on each call
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:16 AM
Then it must be something on the k8s / load balancer layer adding additional latency. 20+ fields is also just too many. Makes no sense to query more than 4-5. If you can group fields by concatenating them into 4-5 "buckets" and the querying on them.
Hariharan
Photo of md5-18c41204e6fd9bb8436d758a90a0e5ef
Hariharan
10:16 AM
We tried on stand alone server too. It is taking minimum 1.5 secs now. As you mentioned, we tried to query only 5 fields. It takes more than 1.5 secs. Can you please refer some documentation for bucket concept as you mentioned in your comments?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:18 AM
Query times will depend on the shape of the data and specific fields queried, what kind of filter is applied, whether facets are used etc. Happy to advise if you can email support ([email protected]) with more details (e.g. schema, sample query and response etc.)
Hariharan
Photo of md5-18c41204e6fd9bb8436d758a90a0e5ef
Hariharan
10:38 AM
We analysed and identified the issue. We are using scoped key which contains filters based on user permissions. Due to this, output takes more time. If i use admin key, then output comes much faster