是否可以并行读取 Lucene.NET 索引段?

发布于 2025-01-01 04:34:52 字数 189 浏览 3 评论 0原文

又如何呢?

我使用标准 FSDirectory 的 IndexReader 和 Collector 来收集结果,但现在我发现读取期间的大部分时间都花在 Lucene.Net.Index.SegmentTermEnum.Next() 上。

读取是在单线程中执行的,由于服务器有 8 个核心,我想加载所有核心。

And how?

I use standart FSDirectory's IndexReader and Collector over it to collect the results, but now I see that most of my time during read is spent in Lucene.Net.Index.SegmentTermEnum.Next().

The read is performed in single thread and since the server has 8 cores i want to load them all.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

能否归途做我良人 2025-01-08 04:34:52

我能想到的唯一内置解决方案是将索引拆分为多个子索引并使用 ParallelMultiSearcher 在其中进行搜索,但我很确定您会看到性能下降,因为 Lucene 通常受 IO 限制而不是 CPU 限制。

另请记住,如果您将所有核心用于单个搜索,则在并行服务多个查询时可能会遇到糟糕的性能。

The only built in solution I can think of is to split you index in several sub indices and use a ParallelMultiSearcher to search in them, but I'm pretty sure you'll see performances decrease as Lucene is typically IO bound and not CPU bound.

Also keep in mind that if you'd use all cores for a single search, you might experience horrible performance when serving multiple queries in parallel.

楠木可依 2025-01-08 04:34:52

您不能将结果拆分到不同的线程中,所有线程都从同一个 IndexReader 读取吗?

Can't you split it the result in different threads, that all read from the same IndexReader?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文