在远程筛选器中查询不同的缓存以进行连续查询



Ignite的连续查询有一个用例,我想在其中设置远程过滤器,使其根据同一节点上的另一个缓存进行评估。例如:

我在Person缓存上开始连续查询,并在另一个缓存("城市"(上使用远程过滤条件,使得p.City存在于城市缓存中。

在我的用例中,我控制城市缓存,这意味着用户可以动态设置他/她感兴趣的城市。城市缓存总体上会相对较小(约400(。我应该提到的是,过滤器必须检查缓存,而不是使用分布式数据结构,因为我需要对订阅进行计数。

基本上,我想了解这种方法对性能的影响。

任何帮助都将不胜感激!

这取决于您在那里创建的逻辑类型。如果你阅读文档,你会看到:

Sets optional key-value filter. This filter is called before entry is sent to the master node.
WARNING: all operations that involve any kind of JVM-local or distributed locking (e.g., synchronization or transactional cache operations), should be executed asynchronously without blocking the thread that called the filter. Otherwise, you can get deadlocks.

这意味着您应该避免在那里阻塞或长时间运行操作。然而,文档也为您提供了如何做到这一点的答案:

If remote filter are annotated with IgniteAsyncCallback then it is executed in async callback pool (see IgniteConfiguration.getAsyncCallbackPoolSize()) that allow to perform a cache operations.

因此,为了避免可能的性能问题,您应该使用IgniteAsyncCallback

最新更新