【问题标题】:Python - cql - Cassandra 1.2 - rpc timeouts when readingPython - cql - Cassandra 1.2 - 读取时 rpc 超时
【发布时间】:2013-09-05 01:38:18
【问题描述】:

我有一个使用 Cassandra 1.2 集群的 Python 应用程序。该集群有 7 个使用虚拟节点的物理节点,其中 1 个密钥空间的复制因子为 3,另一个密钥空间的复制因子为 1。该应用程序使用 cql 库连接到 Cassandra 并运行查询。问题是我在尝试在数据库上运行选择时开始出现错误,并且出现此错误:

Request did not complete within rpc_timeout

当我检查集群的状态时,我可以看到我的一个节点的 cpu 使用率超过 100%,并检查 Cassandra system.log,我可以看到它一直在弹出:

 INFO [ScheduledTasks:1] 2013-06-07 02:02:01,640 StorageService.java (line 3565) Unable to reduce heap usage since there are no dirty column families
 INFO [ScheduledTasks:1] 2013-06-07 02:02:02,642 GCInspector.java (line 119) GC for ConcurrentMarkSweep: 630 ms for 1 collections, 948849672 used; max is 958398464
 WARN [ScheduledTasks:1] 2013-06-07 02:02:02,643 GCInspector.java (line 142) Heap is 0.9900367202591844 full.  You may need to reduce memtable and/or cache sizes.  Cassandra will now flush up to the two largest memtables to free up memory.  Adjust flush_largest_memtables_at threshold in cassandra.yaml if you don't want Cassandra to do this automatically
 INFO [ScheduledTasks:1] 2013-06-07 02:02:02,685 StorageService.java (line 3565) Unable to reduce heap usage since there are no dirty column families
 INFO [ScheduledTasks:1] 2013-06-07 02:02:04,224 GCInspector.java (line 119) GC for ConcurrentMarkSweep: 1222 ms for 2 collections, 931216176 used; max is 958398464
 WARN [ScheduledTasks:1] 2013-06-07 02:02:04,224 GCInspector.java (line 142) Heap is 0.9716378009554072 full.  You may need to reduce memtable and/or cache sizes.  Cassandra will now flush up to the two largest memtables to free up memory.  Adjust flush_largest_memtables_at threshold in cassandra.yaml if you don't want Cassandra to do this automatically
 INFO [ScheduledTasks:1] 2013-06-07 02:02:04,225 StorageService.java (line 3565) Unable to reduce heap usage since there are no dirty column families
 INFO [ScheduledTasks:1] 2013-06-07 02:02:05,226 GCInspector.java (line 119) GC for ConcurrentMarkSweep: 709 ms for 1 collections, 942735576 used; max is 958398464
 WARN [ScheduledTasks:1] 2013-06-07 02:02:05,227 GCInspector.java (line 142) Heap is 0.9836572275641711 full.  You may need to reduce memtable and/or cache sizes.  Cassandra will now flush up to the two largest memtables to free up memory.  Adjust flush_largest_memtables_at threshold in cassandra.yaml if you don't want Cassandra to do this automatically
 INFO [ScheduledTasks:1] 2013-06-07 02:02:05,229 StorageService.java (line 3565) Unable to reduce heap usage since there are no dirty column families
 INFO [ScheduledTasks:1] 2013-06-07 02:02:06,946 GCInspector.java (line 119) GC for ConcurrentMarkSweep: 1271 ms for 2 collections, 939532792 used; max is 958398464
 WARN [ScheduledTasks:1] 2013-06-07 02:02:06,946 GCInspector.java (line 142) Heap is 0.980315419203343 full.  You may need to reduce memtable and/or cache sizes.  Cassandra will now flush up to the two largest memtables to free up memory.  Adjust flush_largest_memtables_at threshold in cassandra.yaml if you don't want Cassandra to do this automatically

关于如何解决这个问题的任何想法?

提前致谢!

【问题讨论】:

    标签: python cassandra cql


    【解决方案1】:

    看起来 Cassandra JVM 堆大小可能太小了,只有 1Gb:

    max is 958398464
    

    假设您的节点上有可用内存,我建议将堆增加到至少 2Gb。

    查看 cassandra-env.sh 以了解如何计算 JVM 堆分配或手动将其设置为特定值。

    【讨论】:

      【解决方案2】:

      您使用什么类型的分区器,您的数据架构是什么?你有多少条记录,你的查询应该返回多少条记录?这些都是我们应该知道的参数,以便为您的问题找到正确答案。

      我以 Cassandra 为例,数据结构设计非常重要,Cassandra 不像 RDBMS 数据库,您可以轻松地在所需的每一列上创建索引,Cassandra 列族必须以在集群节点之间平均分配数据的方式定义避免热点或仅从一个集群节点读取数据,我认为这可能是您的情况下 rpc 超时的原因。

      如果您需要更多信息,请发送更多信息。 谢谢

      希望对你有帮助。

      【讨论】:

        猜你喜欢
        • 2014-09-13
        • 2014-08-06
        • 2016-07-03
        • 2013-02-20
        • 2015-08-11
        • 2019-08-14
        • 2013-09-23
        • 2016-11-26
        • 1970-01-01
        相关资源
        最近更新 更多