2

I am running these in an AWS sever 16GB of memory. Using 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. 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-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:

#********************************************************************
# 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
4

2 回答 2

3

The query that ran out of heap space was using the collect() function in the RETURN clause. That would have attempted to return a collection of over 2 million nodes, which is probably why it ran out of space.

If you wanted to return a count instead, you should have used the count() function instead of collect().

于 2015-07-29T21:09:22.430 回答
0

I restarted the server with more disk space since previously I had only 6% free disk space left. I changed some parameters as described in the comments. For the moment things are working better.

于 2015-07-31T14:36:00.550 回答