red-devil
red-devil

Reputation: 1103

Neo4j-Server clear the cache in RAM

Neo4j server consumes very less RAM initially, but after processing some requests. The RAM consumed by the server increases. Even though no query is been processed it keeps using the RAM. While on restarting the server the RAM consumed is less again.

This states that neo4j server is keeping some data in the RAM, and even though the request is been processed the data still stays in the RAM. Is there anyway to clear that data in the RAM at some threshold to avoid server crash?

Upvotes: 1

Views: 2799

Answers (2)

Xiaomei Zeng
Xiaomei Zeng

Reputation: 33

I guess I have the same problem. So I create one endpoint to flush the cache (Neo4j version is 1.9.9):

    Collection<Cache> caches = ((GraphDatabaseAPI) neo4jTemplate.getGraphDatabaseService()).

    getDependencyResolver().

    resolveDependency(JmxKernelExtension.class).

    getManagementBeans(Cache.class);

    for (Cache cache : caches) {

        cache.clear();

    } 

If neo4j version is over 2.2

((GraphDatabaseAPI)db).getDependencyResolver().resolveDependency( Caches.class ).clear();

Upvotes: 1

Michael Hunger
Michael Hunger

Reputation: 41706

Did you have a server crash?

The data kept in ram is the second level (node and relationship) caches which hold your "hot" dataset.

See this video for detailed explanation: http://watch.neo4j.org/video/46049647

You can clear caches via an JMX endpoint that you can access via jconsole

Upvotes: 1

Related Questions