简体   繁体   English

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

[英]Neo4j - failed processing and refused new connection

I am running these in an AWS sever 16GB of memory. 我在AWS服务器16GB内存中运行这些。 Using Ruby on Rails gem. 使用Ruby on Rails gem。

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

Except the long time to return the result, so far, so good. 除了返回结果的时间长之外,到目前为止,一切都很好。 Then 然后

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}

OK also. 还行

But the next one fails, 但是下一个失败了

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

There are still 9.5 GB free memory. 仍有9.5 GB的可用内存。 During the long execution of the last one I cannot connect to the server using the browser. 在长时间执行最后一个过程中,我无法使用浏览器连接到服务器。

Don't know how to fix this, why the error and why no other connections are allowed? 不知道该如何解决,为什么会出现错误以及为什么不允许其他连接? The failed count statement from Ruby on Rails must return about two millions records when executed from the Neo4j shell, like this: 从Neo4j Shell执行时,Ruby on Rails的count语句失败必须返回大约200万条记录,如下所示:

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

Here is my wrapper.conf file: 这是我的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

The query that ran out of heap space was using the collect() function in the RETURN clause. 堆空间不足的查询正在RETURN子句中使用collect()函数。 That would have attempted to return a collection of over 2 million nodes, which is probably why it ran out of space. 那将试图返回超过200万个节点的集合,这可能就是它空间不足的原因。

If you wanted to return a count instead, you should have used the count() function instead of collect() . 如果您想返回一个计数,则应该使用count()函数而不是collect()

I restarted the server with more disk space since previously I had only 6% free disk space left. 我用更多的磁盘空间重新启动了服务器,因为以前我只剩下6%的可用磁盘空间。 I changed some parameters as described in the comments. 我按注释中所述更改了一些参数。 For the moment things are working better. 目前情况正在好转。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM