Neo4j-Server 清除内存中的缓存 [英] Neo4j-Server clear the cache in RAM

查看:143
本文介绍了Neo4j-Server 清除内存中的缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Neo4j 服务器最初消耗的 RAM 非常少,但在处理了一些请求之后.服务器消耗的RAM增加.即使没有处理任何查询,它也会继续使用 RAM.重新启动服务器时,消耗的 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.

这表明 neo4j 服务器将一些数据保存在 RAM 中,即使请求已处理,数据仍保留在 RAM 中.有没有办法以某个阈值清除 RAM 中的数据以避免服务器崩溃?

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?

推荐答案

我想我也有同样的问题.所以我创建了一个端点来刷新缓存(Neo4j 版本是 1.9.9):

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

    } 

如果neo4j版本超过2.2

If neo4j version is over 2.2

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

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

这篇关于Neo4j-Server 清除内存中的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆