Neo4j - 处理失败并拒绝新连接

时间:2015-07-29 18:32:26

标签: ruby-on-rails neo4j neo4j.rb

我在AWS服务器16GB的内存中运行它们。 使用Ruby on Rails gem。

d = Description.first
CYPHER 14118ms MATCH (n:`Description`) RETURN n ORDER BY n.uuid LIMIT {limit_1} | {:limit_1=>1}

除了长时间返回结果,到目前为止,这么好。 然后

l = d.language
 Description#language 723ms MATCH description24138468, description24138468<-[rel1:`DESCRIBED_IN`]-(result_language:`Language`) WHERE (ID(description24138468) = {ID_description24138468}) RETURN result_language | {:ID_description24138468=>24138468}

也好。

但下一个失败了,

l.descriptions.count
 Language#descriptions 517684ms MATCH (previous:`Language`), previous-[rel1:`DESCRIBED_IN`]->(next:`Description`) WHERE (ID(previous) = {ID_previous}) RETURN ID(previous), collect(next) | {:ID_previous=>137}
Neo4j::Session::CypherError: Java heap space

仍然有9.5 GB的可用内存。 在最后一次执行期间,我无法使用浏览器连接到服务器。

不知道如何解决这个问题,为什么错误以及为什么没有其他连接被允许? Ruby on Rails中失败的count语句在从Neo4j shell执行时必须返回大约两百万条记录,如下所示:

neo4j-sh (?)$ match (l:Language{iso_639_2_code: 'eng'})-[r:DESCRIBED_IN]-(d:Description) return count (d);
+-----------+
| count (d) |
+-----------+
| 2107041   |
+-----------+
1 row
11592 ms

这是我的wrapper.conf文件:

#********************************************************************
# Property file references
#********************************************************************

wrapper.java.additional=-Dorg.neo4j.server.properties=conf/neo4j-server.properties
wrapper.java.additional=-Djava.util.logging.config.file=conf/logging.properties

#********************************************************************
# JVM Parameters
#********************************************************************

wrapper.java.additional=-XX:+UseConcMarkSweepGC
wrapper.java.additional=-XX:+CMSClassUnloadingEnabled
wrapper.java.additional=-XX:-OmitStackTraceInFastThrow
wrapper.java.additional=-XX:hashCode=5

# Uncomment the following lines to enable garbage collection logging
#wrapper.java.additional=-Xloggc:data/log/neo4j-gc.log
#wrapper.java.additional=-XX:+PrintGCDetails
#wrapper.java.additional=-XX:+PrintGCDateStamps
#wrapper.java.additional=-XX:+PrintGCApplicationStoppedTime
#wrapper.java.additional=-XX:+PrintPromotionFailure
#wrapper.java.additional=-XX:+PrintTenuringDistribution

# Java Heap Size: by default the Java heap size is dynamically
# calculated based on available system resources.
# Uncomment these lines to set specific initial and maximum
# heap size in MB.
#wrapper.java.initmemory=512
#wrapper.java.maxmemory=512

#********************************************************************
# Wrapper settings
#********************************************************************
# path is relative to the bin dir
wrapper.pidfile=../data/neo4j-server.pid

#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
#  using this configuration file has been installed as a service.
#  Please uninstall the service before modifying this section.  The
#  service can then be reinstalled.

# Name of the service
wrapper.name=neo4j

# User account to be used for linux installs. Will default to current
# user if not set.
wrapper.user=

#********************************************************************
# Other Neo4j system properties
#********************************************************************
wrapper.java.additional=-Dneo4j.ext.udc.source=debian

2 个答案:

答案 0 :(得分:3)

用尽堆空间的查询使用collect()子句中的RETURN函数。那本可以尝试返回超过200万个节点的集合,这可能是它耗尽空间的原因。

如果您想要返回计数,则应该使用count()函数而不是collect()

答案 1 :(得分:0)

我重启服务器的磁盘空间更大,因为之前我只有6%的可用磁盘空间。 我按照评论中的描述更改了一些参数。 目前情况正在好转。