ignite - 查询远程过滤器内的不同缓存以进行连续查询
问题描述
我有一个 Ignite 连续查询的用例,我想在其中设置远程过滤器,以便它针对同一节点上的另一个缓存进行评估。例如:
我开始对 Person 缓存进行连续查询,并在另一个缓存(“City”)上使用远程过滤条件,以便 P.city 存在于 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。
推荐阅读
- sql - SQL查询中左连接之后的所有连接是否也必须是左连接?为什么或者为什么不?
- python - Python非唯一排列处理
- python - 为 Visual Studio Code 安装 Python 包
- powershell - SHA512 与 powershell 中的盐编码
- java - 如何在apache代理后面为tomcat应用程序实现漂亮的url
- python - 调用 str.split("a string") 是否比调用 "a string".split() 更好?
- php - PHP邮件程序不创建新行
- c# - 使用其他列值条件 LINQ 返回列值的标准偏差
- javascript - 如何为读取/写入 MySQL 数据库的函数编写单元测试?
- python - 如何有效地将整数映射到多维度数组中的 URI?