Python - cql - Cassandra 1.2 - 读取时的rpc超时

时间:2013-06-07 02:11:32

标签: python cassandra cql

我有一个使用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

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

提前致谢!

2 个答案:

答案 0 :(得分:2)

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

max is 958398464

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

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

答案 1 :(得分:1)

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

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

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

我希望这可以帮到你。