1.neo4j节点数和边关系数达到千万上亿,频繁崩溃,查看内存显示java占用内存过高
解决方案:
使用命令:./neo4j-admin memrec --database=graph.db
得到如下信息:
# Memory settings recommendation from neo4j-admin memrec:
#
# Assuming the system is dedicated to running Neo4j and has 7800m of memory,
# we recommend a heap size of around 3500m, and a page cache of around 1900m,
# and that about 2500m is left for the operating system, and the native memory
# needed by Lucene and Netty.
#
# Tip: If the indexing storage use is high, e.g. there are many indexes or most
# data indexed, then it might advantageous to leave more memory for the
# operating system.
#
# Tip: The more concurrent transactions your workload has and the more updates
# they do, the more heap memory you will need. However, don't allocate more
# than 31g of heap, since this will disable pointer compression, also known as
# "compressed oops", in the JVM and make less effective use of the heap.
#
# Tip: Setting the initial and the max heap size to the same value means the
# JVM will never need to change the heap size. Changing the heap size otherwise
# involves a full GC, which is desirable to avoid.
#
# Based on the above, the following memory settings are recommended:
dbms.memory.heap.initial_size=3500m
dbms.memory.heap.max_size=3500m
dbms.memory.pagecache.size=1900m
#
# The numbers below have been derived based on your current data volume in database and index configuration of database 'graph.db'.
# They can be used as an input into more detailed memory analysis.
# Lucene indexes: 0k
# Data volume and native indexes: 14200m
根据给出的推荐配置,修改neo4j.conf如下三个选项,重启neo4j即可。
```bash
dbms.memory.heap.initial_size
dbms.memory.heap.max_size
bms.memory.pagecache.size=1900m
```