0
votes

I am evaluating Neo4j in windows. Since, i need to access Neo4j from a .NET app, I am using the Neo4j Cypher REST API through a .NET client library (http://hg.readify.net/neo4jclient/).

When traversing a reasonably sized graph (About 100,000 nodes), I am facing "Out of memory" issues in the Neo4j java server. Below is the exception that is reported in the REST response. Also, mentioned below is the cypher query that was run. I have tried to increase the JVM heap space with a -Xmx1024m option for the Neo4j server, but that did not help. Would appreciate any other suggestions.

Unhandled Exception: System.ApplicationException: Received an unexpected HTTP st atus when executing the request.

The query was:
START x = node(1213997)
MATCH x-[:BOM*1..5]->n RETURN 'BOM' AS RelationshipType, n.Number? AS Number, n.Id? AS Id

The response status was: 500 Java heap space

The raw response body was: <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500 Java heap space</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /db/data/cypher. Reason:
<pre>    Java heap space</pre></p><h3>Caused by:</h3><pre>java.lang.OutOfMemoryE
rror: Java heap space
        at java.lang.AbstractStringBuilder.&lt;init&gt;(Unknown Source)
        at java.lang.StringBuilder.&lt;init&gt;(Unknown Source)
        at org.neo4j.server.rest.repr.RepresentationType.&lt;init&gt;(Representa
tionType.java:108)
        at org.neo4j.server.rest.repr.Representation.&lt;init&gt;(Representation
.java:73)
        at org.neo4j.server.rest.repr.ListRepresentation.&lt;init&gt;(ListRepres
entation.java:36)
        at org.neo4j.server.rest.repr.CypherResultRepresentation.data(CypherResu
ltRepresentation.java:64)
2
Please explain a little more what your objective is with this query. It does seem to list a whole lot of data without much purpose.Louis-Philippe Huberdeau
The requirement is to get the entire product or a document structure starting from a root node. So, while in most cases the data size will not be this big, i am trying to find the boundary condition for such a query.Arvind Kumar
Did you try paginating results to see if that helps?Louis-Philippe Huberdeau
for the 1.8 release there are several improvements on its way, one of them being streaming results, which will solve your issue.Michael Hunger
until then you can have a look at this extension: github.com/neo4j-contrib/streaming-cypherMichael Hunger

2 Answers

0
votes

A depth 5 traversal can potentially touch the majority of your graph... what are you planning to do with the result? Is it necessary to return the entire result? If you're only using some part of it maybe you could specify that in the Cypher query directly to limit the result.

0
votes

In newer versions, you can do

start n = node(*) ...

see http://docs.neo4j.org/chunked/snapshot/query-start.html#start-all-nodes, to start at all nodes, which is what you want? But then, you are returning the whole graph a number of times back?