Slackbot
10/09/2023, 7:43 AMKishore Nallan
10/09/2023, 7:45 AMErik Merkley
10/09/2023, 7:57 AMErik Merkley
10/10/2023, 7:43 AMe5-small-v2. I can import 500 products in 2min 45s, which seems reasonable: 270ms per document.
Attempting to add the same batch on the same cluster with gte-small has totally locked up the cluster (mostly getting timeouts or 504 errors just using the Typesense Cloud dashboard). Looks like it's come good after 10min, so about 1.2s per document.
I guess gte-small is just super slow? I'll push ahead with e5-small-v2 and see how it goes for semantic search.
Just getting back to my other question, how would a HA cluster react while the embeddings are being generated? Would it still lock up and stop serving requests or does only one server handle the import? What if my code sends multiple batches of documents simultaneously?
It's alright having the import process take 10-20min or longer as long as search requests can still be served for that time.Kishore Nallan
10/10/2023, 3:27 PMgte-small is so slow.
how would a HA cluster react while the embeddings are being generated? Would it still lock up and stop serving requests or does only one server handle the import? What if my code sends multiple batches of documents simultaneously?In a HA cluster the embedding will be generated on all the 3 nodes independently. For remote embedding (like OpenAI) the embedding requests are forwarded to a single node though (leader) because of the API costs involved in duplication of requests. The reads and write are interleaved during import so you will experience some additional query latency.
Erik Merkley
10/11/2023, 12:37 AMKishore Nallan
10/11/2023, 1:46 AMErik Merkley
10/11/2023, 2:08 AMErik Merkley
10/11/2023, 2:23 AMadditional query latencyI don't have enough documents to test what is typical during an import without text embeddings. But while generating the embeddings, I'm seeing search latency of 2.5s to beyond the timeout of 5s which is problematic for a live site. I have a theory here, but correct me if I'm wrong. Typesense internally queues up index writes in small batches (of around 40 documents?). I guess that's the "Pending Write Batches" on the dashboard of Typesense Cloud. It interleaves these batch writes with incoming reads. Without text embeddings, a write of 40 documents would take an insignificant amount of time, maybe a few milliseconds. So the additional latency to a queued read is minimal. But if each of those 40 documents needs text embeddings and they take at least 250ms each - potentially much more than that with a large model - then that write of 40 or so documents takes much longer, and the read is potentially delayed many seconds. Would I be on the right track? That definitely aligns with the behaviour I'm seeing. It means semantic search is great for a fixed index or one that can be updated offline, but is problematic for an index being accessed live and regularly updated - like my ecommerce website.
Kishore Nallan
10/11/2023, 3:47 AMKishore Nallan
10/11/2023, 3:49 AMErik Merkley
10/12/2023, 7:39 AM{batch_size: 2} on the import. I expected that would make the import slower overall, but reduce the search latency because Typesense would service the read queue much more often. I don't get that result though - search latencies are still at least several seconds, with about half hitting the 5s timeout. Are you sure that batch_size param is actually working? It seems to have no effect on the latency or on the Pending Write Batches shown on the dashboard. I'd have expected that to spike much higher. I'm no C++ expert but I had a look through the source and can't see it doing anything useful.
Thanks for persisting with me!Kishore Nallan
10/12/2023, 7:44 AMErik Merkley
10/12/2023, 7:45 AMbatch_size to get Typesense to check the read queue more oftenErik Merkley
10/12/2023, 7:52 AMKishore Nallan
10/12/2023, 8:39 AMErik Merkley
10/12/2023, 8:45 AM