Neo4j-Server clear the cache in RAM

三世轮回 提交于 2019-12-25 03:42:59

问题


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?


回答1:


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




回答2:


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();



来源:https://stackoverflow.com/questions/26189351/neo4j-server-clear-the-cache-in-ram

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!