【问题标题】:Apache Ignite Query Cursor getAll is very slowApache Ignite Query Cursor getAll 非常慢
【发布时间】:2018-11-08 02:38:35
【问题描述】:

我在单个数据区域中加载了 200 个缓存。其中我有一个 拥有 300K 记录的 customerCache。它有许多索引字段,包括 顾客号码。

当我在此特定缓存上使用 SQLFieldsQuery 进行查询时(其中 条件只有客户编号 = ?),大约需要 280ms 来查询一个 客户!

详细分析发现,SQLFieldQueryCursor.getAll()是 消耗 99% 的时间(获取缓存实例和查询执行是 在纳秒到 1 毫秒范围内完成)。有什么方法可以调 cursor.getAll() 或任何从游标获取数据的替代方法。

更多信息

我已经用@Id 注释了客户编号,所以假设它们被索引并且所有查询的字段都用@QuerySqlField 注释

缓存配置如下:

dataRegionCfg.setInitialSize(8L * 1024 * 1024 * 1024);
dataRegionCfg.setMaxSize(8L*1024*1024*1024);
dataRegionCfg.setPersistenceEnabled(false);
dataStorageCfg.setDataRegionConfigurations(dataRegionCfg);
dataStorageCfg.setPageSize(4096);
customerCacheConfig = new CacheConfiguration<>("customerCache");
customerCacheConfig.setIndexedTypes(CustomerKey.class, Customer.class);
customerCacheConfig.setReadThrough(false);
customerCacheConfig.setAtomicityMode(ATOMIC);
customerCacheConfig.setCacheMode(CacheMode.LOCAL);

我的查询是:

select customerName,customerId from CustomerMaster where customerNumber = ?;

请提供一些提示以提高性能或让我知道如果我是 这里缺少一些东西。

【问题讨论】:

  • 请提供准确的缓存配置,包括索引,以及 sn-p 中的完整原始查询。
  • @alamar 我已经用请求的项目更新了问题。
  • 你能提供CustomerKeyCustomer的来源吗?我强烈怀疑您实际上在customerNumer 上没有索引,因为您的密钥是CustomerKey,您应该使用@QuerySqlField(index=true) 声明它
  • 能否也粘贴查询EXPLAIN select customerName,customerId from CustomerMaster where customerNumber = ?的完整输出?
  • 我的 CustomerKey 只有一个 UUID 字段,我还没有索引该字段。但是我已经索引了具有客户编号的客户模型。我也应该索引关键类字段吗?

标签: java performance ignite


【解决方案1】:

感谢 Alamar 指出正确的方法。我在服务器节点中部署的 jar 错过了 index = true 选项。

Also ignite 不期望在键类中建立索引。同样,性能不会通过增加数量或索引来提高,就像 H2 一样。

【讨论】:

    猜你喜欢
    • 2017-06-08
    • 2013-07-31
    • 1970-01-01
    • 1970-01-01
    • 2012-02-08
    • 1970-01-01
    • 1970-01-01
    • 2013-07-11
    • 1970-01-01
    相关资源
    最近更新 更多