【发布时间】:2016-05-31 12:26:08
【问题描述】:
我有一个顶点节点实体,它有一个关系列表。
@NodeEntity (label="User")
public class Vertex {
private Long id;
private String name;
@Index(unique=true)
private String email;
@Relationship(type="WORKS_WITH", direction = Relationship.OUTGOING)
private List<Edge> teammates;
..
}
@RelationshipEntity(type = "WORKS_WITH")
public class Edge {
@GraphId
private Long relationshipId;
@Property
private double weight;
@StartNode
private Vertex src;
@EndNode
private Vertex dest;
}
我有一个 Spring Boot 应用程序,我正在使用带有本地 neo4j 服务器的 spring-data-neo4j (4.0.0)。当我在边缘列表中保存具有 3-10 个边缘的顶点对象时,它运行良好。如果边列表变大(最多 20-30 个边对象),应用程序将无法保存顶点。 我使用 org.springframework.data.neo4j 中的 GraphRepository 保存顶点:
vertexRepository.save(vertex);
我已将所有调整参数保留为默认值,因为我还没有保存大量数据。我已将内存池和永久代空间的大小设置为:
export JAVA_OPTS="-Xmx256M -XX:MaxPermSize=512M"
在我得到的消息日志中:
2016-05-31 12:12:06.592+0000 WARN [o.n.k.i.c.MonitorGc] GC Monitor: Application threads blocked for 327ms.
2016-05-31 12:12:08.256+0000 WARN [o.n.k.i.c.MonitorGc] GC Monitor: Application threads blocked for 260ms.
2016-05-31 12:12:09.915+0000 WARN [o.n.k.i.c.MonitorGc] GC Monitor: Application threads blocked for 258ms.
2016-05-31 12:12:12.690+0000 WARN [o.n.k.i.c.MonitorGc] GC Monitor: Application threads blocked for 269ms.
Neo4j 文档建议,对于 200 万个节点,您需要 512Mb 的堆,这样就足以满足我的情况。
我的机器是 Google Compute Engine 实例:自定义(2 个 vCPU,8 GB 内存)。这可能是什么问题?
【问题讨论】:
标签: neo4j spring-data-neo4j spring-data-neo4j-4