[英]How to enhance parallelism in a python client for elasticsearch?
I am new to elasticsearch and I need to optimize a python client to do the search/indexing on a elasticsearch cluster.我是elasticsearch 的新手,我需要优化一个python 客户端来在elasticsearch 集群上进行搜索/索引。 It seems to me that the bottleneck is the client itself, and that elasticsearch can handle more queries.
在我看来,瓶颈是客户端本身,而elasticsearch 可以处理更多的查询。 I would like to know how I can make my program more optimal to enhance performance.
我想知道如何使我的程序更加优化以提高性能。 Should I use multi-processing or multi-threading or there is a more elegant way to do the work.
我应该使用多处理还是多线程,或者有更优雅的方式来完成这项工作。 Thank you
谢谢
If your ES server can easily handle multiple request you can use a ThreadPoolExecutor in order to run multiple queries concurrently.如果您的 ES 服务器可以轻松处理多个请求,您可以使用ThreadPoolExecutor来同时运行多个查询。
As the operation is mainly IO driven, using threads should be enough.由于操作主要是IO驱动,使用线程应该足够了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.