【问题标题】:AerospikeError Operation not allowed at this time while doing only readsAerospikeError 仅读取时此时不允许操作
【发布时间】:2021-03-31 10:42:34
【问题描述】:

我正在尝试使用 50 个并行读取请求对我的代码进行负载测试。

我正在根据我创建的多个索引查询数据。代码如下所示:

const fetchRecords = async (predicates) => {
  let query = aeroClient.query('test', 'mySet');

  let filters = [
      predexp.stringValue(predicates.load),
      predexp.stringBin('load'),
      predexp.stringEqual(),
      predexp.stringValue(predicates.disc),
      predexp.stringBin('disc'),
      predexp.stringEqual(),
      predexp.integerBin('date1'),
      predexp.integerValue(predicates.date2),
      predexp.integerGreaterEq(),
      predexp.integerBin('date2'),
      predexp.integerValue(predicates.date2),
      predexp.integerLessEq(),
      predexp.stringValue(predicates.column3),
      predexp.stringBin('column3'),
      predexp.stringEqual(),
      predexp.and(5),
  ]
  query.where(filters);

  let records = [];
  let stream = query.foreach();
  stream.on('data', record => {
      records.push(record); 
  })
  stream.on('error', error => { throw error });
  await new Promise((resolve, reject) => {
      stream.on('end', () => resolve());
  });
  return records;
}

这失败了,我收到以下错误:

 AerospikeError: Operation not allowed at this time.
    at Function.fromASError (/Users/.../node_modules/aerospike/lib/error.js:113:21)
    at QueryCommand.convertError (/Users/.../node_modules/aerospike/lib/commands/command.js:91:27)
    at QueryCommand.convertResponse (/Users/.../node_modules/aerospike/lib/commands/command.js:101:24)
    at asCallback (/Users/.../node_modules/aerospike/lib/commands/command.js:163:24)

我的aerospike.conf内容:

service {
    user root
    group root
    paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1.
    pidfile /var/run/aerospike/asd.pid
#   service-threads 6 # cpu x 5 in 4.7 
#   transaction-queues 6 # obsolete in 4.7 
#   transaction-threads-per-queue 4 # obsolete in 4.7
    proto-fd-max 15000
}
<...trimmed section>
namespace test {
    replication-factor 2
    memory-size 1G
    default-ttl 30d # 5 days, use 0 to never expire/evict.
    nsup-period 120
    #   storage-engine memory

    # To use file storage backing, comment out the line above and use the
    # following lines instead.

    storage-engine device {
        file /opt/aerospike/data/test.dat
        filesize 4G
        data-in-memory true # Store data in memory in addition to file.
    }
}

从一个类似的问题中,我发现这是由于系统配置低导致的。 我该如何修改这些。另外,我相信 50 个请求应该可以工作,因为我能够插入大约 12K 记录/秒。

【问题讨论】:

    标签: node.js aerospike aerospike-ce


    【解决方案1】:

    我猜这些是扫描而不是单个读取。增加scan-threads-limit

    asinfo -v "set-config:context=service;scan-threads-limit=128"

    【讨论】:

    • 我试过了,但没有任何改善。每个请求平均需要 300 毫秒。
    • 我假设 asinfo 不需要我重新启动,因为它是动态更改的。
    • 是的,这是动态的,不需要重新启动。检查服务器日志以获取有关正在进行的扫描次数的提示或有关已达到限制的任何警告。
    猜你喜欢
    • 1970-01-01
    • 2017-08-16
    • 2015-02-04
    • 2015-12-05
    • 2019-12-24
    • 2018-07-21
    • 1970-01-01
    • 1970-01-01
    • 2011-11-23
    相关资源
    最近更新 更多