【发布时间】:2017-08-30 18:00:54
【问题描述】:
我一直在尝试使用带有 1 个 CPU 和 1GB RAM 的 SpringDataNeo4j(SDN) 同时加载测试。 对于“GET”(读取)请求,能够测试 1000 个线程,加速时间为 1 秒。 对于“POST”(写入)请求,但只能使用 18 个线程进行测试,加速时间为 1 秒,超出此线程。我们面临死锁异常:
原因:org.neo4j.ogm.exception.CypherException:执行 Cypher “Neo.TransientError.Transaction.DeadlockDetected”时出错;代码:Neo.TransientError.Transaction.DeadlockDetected;描述:LockClient[1081] 不能等待资源 RWLock[NODE(97), hash=108078135] 因为 => LockClient[1081]
我已经提到 http://neo4j.com/docs/java-reference/current/#transactions-deadlocks
TransactionTemplate template = new TransactionTemplate( ).retries( 5 ).backoff( 3, TimeUnit.SECONDS );
对于 saveService,我使用默认的 @Transactional,尽管我无法在我的测试代码中复制 TransactionTemplate。我使用我的 DataSourceFactory 配置。
@Configuration
@PropertySource(value = { "classpath:ogm.properties" }
@EnableNeo4jRepositories(basePackages = "com.my.graph.repository")
@EnableTransactionManagement
任何建议!
提前致谢!
【问题讨论】:
-
你在写测试中使用的密码语法是什么?
-
我没有在这种情况下使用密码。我正在使用 API 扩展 GraphRepository 的 OGM 'Dao.save(node)'
标签: java multithreading neo4j spring-data spring-data-neo4j