Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION]: When I use multiple threads to request Milvus' data, why do I have good QPS growth for 1,2,3 threads, but no QPS growth for more than 3 threads? #2270

Open
1 task done
HungryFour opened this issue Sep 23, 2024 · 0 comments
Labels
kind/question A question to answer

Comments

@HungryFour
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

What is your question?

When I use multiple threads to request Milvus' data, why do I have good QPS growth for 1,2,3 threads, but no QPS growth for more than 3 threads? Standalone version using Docker deployment. Start with standalone_embed.sh without the user.yaml file.

    def multi_query(self, X: numpy.array, n: int, num_threads: int):

        if not self.collection:
            self.collection = Collection(self.collection_name, consistence_level="STRONG")
            self.load_collection()

        total_count = len(X)
        per_count = total_count / 10
        def single_query(idx, v, n):
            try:
                # conn = conn_pool.get_connection()
                start = time.time()
                results = self.collection.search(
                    data=[v.tolist()],
                    anns_field="vector",
                    param=self.search_params,
                    limit=n,
                    output_fields=["id", "vector"])
                total = time.time() - start
                res = [(v, r.entity.get("id"), r.entity.get("vector")) for r in results[0]]
                if (idx + 1) % per_count == 0:
                    print(
                        f"Read Processed: {round((idx + 1) / total_count * 100, 1)}%,Complete:{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())}")
                return (start, total, res)
            except Exception as e:
                print(f"Error executing query: {e}")
                return None
            # finally:
            #     if conn is not None:
            #         conn_pool.release_connection(conn)

        with ThreadPoolExecutor(max_workers=num_threads) as pool:
            results = pool.map(lambda idx_v: single_query(idx_v[0], idx_v[1], n), enumerate(X))
        self.res = [result for result in results if result is not None]

Anything else?

No response

@HungryFour HungryFour added the kind/question A question to answer label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question A question to answer
Projects
None yet
Development

No branches or pull requests

1 participant