Knowledge Base

Retired: How to manually clear the Node and Relationship Cache

This is no longer applicable in Neo4j 2.3+ The second level object cache was removed in favor of a more scalable off-heap page-cache.

When troubleshooting transient issues or testing out queries on warm vs. cold cache, you may want to try clearing out the cache without necessarily restarting the Neo4j database.

To achieve this, you need to trigger the clear() method on the JMX bean for relationship and/or node cache.

You can do this by connecting to your JVM using JConsole or JVisualVM, and navigating to the NodeCache and RelationshipCache JMX beans. Once there, simply invoke the clear() method.

Here is a screen capture of what JConsole looks like when executing this operation:

how to manually clear the node and relationship cache NN28Uqg