如何防止Cassandra 2.0.11在启动时耗尽内存?

时间:2014-11-09 12:25:16

标签: cassandra out-of-memory

我正在尝试使用以下配置设置单个节点cassandra-instance用于测试目的:

rpc_address: 10.0.2.108
listen_address: 10.0.2.108
endpoint_snitch: SimpleSnitch

seed_provider:
# Addresses of hosts that are deemed contact points.
# Cassandra nodes use this list of hosts to find each other and learn
# the topology of the ring.  You must change this if you are running
# multiple nodes!
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
  parameters:
      # seeds is actually a comma-delimited list of addresses.
      # Ex: "<ip1>,<ip2>,<ip3>"
      - seeds: 10.0.2.108

我已经通过多种方式更改了配置,但我总是得到一个OutOfMemoryException:

INFO [main] 2014-11-09 13:00:10,808 TDisruptorServer.java (line 209) Going to use org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor@173b9122[Running, pool size = 16, active threads = 0, queued tasks = 0, completed tasks = 0] for all of the Selector threads.. ERROR [main] 2014-11-09 13:00:11,000 CassandraDaemon.java (line 513) Exception encountered during startup
java.lang.OutOfMemoryError: Java heap space
    at com.thinkaurelius.thrift.TDisruptorServer$SelectorThread.<init>(TDisruptorServer.java:543)
    at com.thinkaurelius.thrift.TDisruptorServer.<init>(TDisruptorServer.java:228)
    at org.apache.cassandra.thrift.THsHaDisruptorServer.<init>(THsHaDisruptorServer.java:51)
    at org.apache.cassandra.thrift.THsHaDisruptorServer$Factory.buildTServer(THsHaDisruptorServer.java:105)
    at org.apache.cassandra.thrift.TServerCustomFactory.buildTServer(TServerCustomFactory.java:56)
    at org.apache.cassandra.thrift.ThriftServer$ThriftServerThread.<init>(ThriftServer.java:130)
    at org.apache.cassandra.thrift.ThriftServer.start(ThriftServer.java:56)
    at org.apache.cassandra.service.CassandraDaemon.start(CassandraDaemon.java:449)
    at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:509)
    at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:585)
INFO [StorageServiceShutdownHook] 2014-11-09 13:00:11,055 Server.java (line 182) Stop listening for CQL clients
INFO [StorageServiceShutdownHook] 2014-11-09 13:00:11,056 Gossiper.java (line 1307) Announcing shutdown
INFO [StorageServiceShutdownHook] 2014-11-09 13:00:13,057 MessagingService.java (line 701) Waiting for messaging service to quiesce
INFO [ACCEPT-/10.0.2.108] 2014-11-09 13:00:13,058 MessagingService.java (line 941) MessagingService has terminated the accept() thread    

机器总内存为4 GB。

1 个答案:

答案 0 :(得分:3)

这是https://issues.apache.org/jira/browse/CASSANDRA-8116解决的错误。通过将 rpc_max_threads 设置为默认值Integer.MAX_VALUE以外的值,可以在2.0.11中修复它。

HsHA服务器已更改,现在使用rpc_max_threads值为每个选择器线程分配处理程序。因此OOM在尝试分配Integer.MAX_VALUE处理程序时