我们使用机器学习技术将英文博客翻译为简体中文。您可以点击导航栏中的“中文(简体)”切换到英文版本。
实现更高的查询吞吐量:Amazon OpenSearch 无服务器中的自动扩展现在支持分片副本扩展
在发布时,OpenSearch Serverless 支持自动增加容量以应对不断增长的数据大小。借助新的分片副本扩展功能,OpenSearch Serverless 可自动检测由于查询速率突然飙升而受到胁迫的分片,并动态添加新的分片副本以处理增加的查询吞吐量,同时保持快速的响应时间。事实证明,这种方法比简单地添加新的索引副本更具成本效益。随着对更多副本的扩展支持,OpenSearch Serverless 现在每分钟可以处理数千次查询事务。当工作负载需求减少时,OpenSearch Serverless 还将跨可用区将分片副本无缝扩展到至少两个活跃副本。
扩展概述
以一个使用 OpenSearch Serverless 作为后端搜索引擎来托管其产品目录的电子商务网站为例。
|
In the following figure, an index has four shards to handle the product catalog. All four shards fit into one OpenSearch Capacity Unit (OCU). Because OpenSearch Serverless is designed to cater to production systems, it will automatically create an additional set of replicas for these four shards, which are hosted in a separate Availability Zone. Both sets of search replicas will actively respond to the incoming traffic load. |
|
When new products are launched, they often generate more interest, resulting in increased traffic and search queries on the website in the days following the launch. In this scenario, the shards containing the data for the new product will receive significantly higher volume of search requests than other shards within the same index. OpenSearch Serverless will identify these shards as hot shards because they’re close to breaching the system thresholds. |
|
To handle the spike in search requests, OpenSearch Serverless will vertically scale the OCUs and then move the hot shards to a new OCU if required to balance the high query rates. The following figure shows how the shards would be moved to a new OCU along with other normally loaded shards. |
|
If OpenSearch Serverless keeps receiving additional search requests for shards, it will add new replicas for the shard until all shard replicas can effectively handle the incoming query rates without exceeding the system thresholds. Even after the traffic is successfully handled by OpenSearch Serverless, it continues to evaluate the shard state. When the load on the shards reduces, OpenSearch Serverless will scale down the shard replicas to maintain the minimum OCU and replicas required for the workload. |
副本向外扩展的搜索性能
我们对代表产品目录的搜索语料库进行了性能测试,该目录包含 600,000 个文档和大约 500 MB。这些查询混合了术语查询、模糊查询和聚合查询。OpenSearch Serverless 能够处理每秒 613 笔交易 (TPS),P50 延迟为 2.8 秒,而通过副本扩展,我们看到搜索吞吐量扩展到 1423 TPS,吞吐量增加了 100%,P50 延迟为 690 毫秒,从而使响应时间缩短了 75%。下表总结了我们的结果。请注意,您可以配置最大 OCU 限制来控制成本。
| . | Initial OCUs | Scaled OCUs | TPS | P50 Latency | Number of Replicas |
| With no replica scaling | 2 | 26 | 613 | 2.8 secs | 2 |
| With replica scaling | 2 | 100 | 1423 | 619ms | Replica scaling scales the hot shards up to 8 replicas |
下图显示,在相同的负载配置文件下,新的自动扩展功能在24小时内处理了更多的查询,同时持续保持较低的延迟。
第一张图显示了没有自动扩展的系统性能概况。
第二张图显示了具有副本扩展功能的系统性能概况。
结论
在这篇文章中,我们展示了用于自动扩展的 OpenSearch Serverless 新的分片副本向外扩展功能如何帮助您实现更高的吞吐量,同时保持搜索和时间序列收集的成本效益。它会在胁迫下自动扩展这些分片的副本,而不是为整个索引添加副本。
如果您对这篇文章有反馈,请在评论部分分享。如果您对这篇文章有疑问,请在
作者简介
萨蒂什·南迪 是亚马逊 OpenSearch S
ervice 的高级技术产品经理。
*前述特定亚马逊云科技生成式人工智能相关的服务仅在亚马逊云科技海外区域可用,亚马逊云科技中国仅为帮助您发展海外业务和/或了解行业前沿技术选择推荐该服务。