在执行大量写操作时增加neo4j性能

时间:2018-03-29 23:07:26

标签: performance neo4j database-performance

我正在尝试通过我的应用程序将数据加载到neo4j中。这是使用螺栓驱动程序。我的应用程序最初是非常密集的。我无法减少加载时间,因为neo4j写入螺栓驱动程序似乎很慢。我看到所有线程在下面操作:

at sun.nio.ch.FileDispatcherImpl.read0(java.io.FileDescriptor, long, int)
  at sun.nio.ch.SocketDispatcher.read(java.io.FileDescriptor, long, int)
  at sun.nio.ch.IOUtil.readIntoNativeBuffer(java.io.FileDescriptor, java.nio.ByteBuffer, long, sun.nio.ch.NativeDispatcher)
  at sun.nio.ch.IOUtil.read(java.io.FileDescriptor, java.nio.ByteBuffer, long, sun.nio.ch.NativeDispatcher)
  at sun.nio.ch.SocketChannelImpl.read(java.nio.ByteBuffer)
  at org.neo4j.driver.internal.security.TLSSocketChannel.channelRead(java.nio.ByteBuffer) (line: 159)
  at org.neo4j.driver.internal.security.TLSSocketChannel.unwrap(java.nio.ByteBuffer) (line: 229)
  at org.neo4j.driver.internal.security.TLSSocketChannel.read(java.nio.ByteBuffer) (line: 419)
  at org.neo4j.driver.internal.net.BufferingChunkedInput.readNextPacket(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer) (line: 409)
  at org.neo4j.driver.internal.net.BufferingChunkedInput.readChunkSize() (line: 345)
  at org.neo4j.driver.internal.net.BufferingChunkedInput.read(java.nio.ByteBuffer) (line: 247)
  at org.neo4j.driver.internal.net.BufferingChunkedInput.fillScratchBuffer(int) (line: 216)
  at org.neo4j.driver.internal.net.BufferingChunkedInput.readByte() (line: 110)
  at org.neo4j.driver.internal.packstream.PackStream$Unpacker.unpackStructHeader() (line: 430)
  at org.neo4j.driver.internal.messaging.PackStreamMessageFormatV1$Reader.read(org.neo4j.driver.internal.messaging.MessageHandler) (line: 398)
  at org.neo4j.driver.internal.net.SocketClient.receiveOne(org.neo4j.driver.internal.net.SocketResponseHandler) (line: 176)
  at org.neo4j.driver.internal.net.SocketConnection.receiveOne() (line: 212)
  at org.neo4j.driver.internal.net.ConcurrencyGuardingConnection.receiveOne() (line: 165)
  at org.neo4j.driver.internal.net.pooling.PooledSocketConnection.receiveOne() (line: 183)
  at org.neo4j.driver.internal.InternalStatementResult.receiveOne() (line: 335)
  at org.neo4j.driver.internal.InternalStatementResult.tryFetchNext() (line: 325)
  at org.neo4j.driver.internal.InternalStatementResult.hasNext() (line: 193)
  • 堆内存最小值和最大值= 4Gb
  • 页面缓存大小= 2 GB
  • 总数据库大小约为2 GB(预计会增长到10 GB)

有没有办法可以针对上述操作进行优化?我也可以将堆增加到8 GB,因为其他应用程序也在这台机器上运行。

1 个答案:

答案 0 :(得分:0)

如果您的应用程序是写密集型的,那么您可以通过批处理事务执行写操作而受益(从您的应用程序执行此操作 - >聚合节点\边缘直到您到达此方,打开一个事务,并在达到此大小时提交)。你可以玩批量大小(1000,10000),看看哪种方式最适合你。