I am writing a Java program that uses an embedded Neo4j graph with TinkerPop. Here's the relevant section of my pom
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>neo4j-gremlin</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-tinkerpop-api-impl</artifactId>
<version>0.7-3.2.3</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-tinkerpop-api</artifactId>
<version>0.1</version>
</dependency>
I want to add a configuration option to set the page cache size when initializing the graph. My PS Old Gen heap space is filling up.
Currently, I'm opening the Neo4j graph by passing it a org.apache.commons.configuration.Configuration object. I’m trying to set two properties, the directory and the pagecache. When I run my program, the "gremlin.neo4j.directory" property is processed, but the "dbms.memory.pagecache.size" is not, according to the graph's log file. The log file's first line is this:
2019-03-20 14:38:36.155+0000 WARN [o.n.i.p.PageCache] The dbms.memory.pagecache.size setting has not been configured. It is recommended that this setting is always explicitly configured, to ensure the system has a balanced configuration. Until then, a computed heuristic value of 8310519808 bytes will be used instead.
Using jvisualvm and jconsole, I can see that the memory in the PS Old gen is filling up with objects related to page caching so I'm trying to throttle how much data is cached by Neo4j.
Here's my code:
Configuration configuration = new BaseConfiguration();
configuration.addProperty("gremlin.neo4j.directory", "tmp/mygraph");
configuration.addProperty("dbms.memory.pagecache.size", "500m");
myGraph = Neo4jGraph.open(configuration);
Any idea what I'm doing wrong?
I think that you need to prefix your configuration keys that are Neo4j specific with gremlin.neo4j.conf
thus:
Configuration configuration = new BaseConfiguration();
configuration.addProperty("gremlin.neo4j.directory", "tmp/mygraph");
configuration.addProperty("gremlin.neo4j.conf.dbms.memory.pagecache.size", "500m");
myGraph = Neo4jGraph.open(configuration);