Neo4j节点创建速度

Neo4j节点创建速度,neo4j,Neo4j,我的笔记本电脑上有一个新的neo4j设置,通过RESTAPI创建新节点似乎相当慢(平均约30-40毫秒)。我在谷歌上搜索了一下,但找不到任何关于“应该”花多长时间的真正基准;有,但只列出了相对性能,而不是绝对性能。neo4j是否天生只限于每秒添加约30个新节点(批处理模式之外),或者我的配置是否有问题 配置详细信息: Neo4j版本2.2.5 服务器位于我的2014年中端笔记本电脑上,运行Ubuntu 15.04 OpenJDK 1.8版 对服务器的呼叫也来自我的笔记本电脑(通过localho

我的笔记本电脑上有一个新的neo4j设置,通过RESTAPI创建新节点似乎相当慢(平均约30-40毫秒)。我在谷歌上搜索了一下,但找不到任何关于“应该”花多长时间的真正基准;有,但只列出了相对性能,而不是绝对性能。neo4j是否天生只限于每秒添加约30个新节点(批处理模式之外),或者我的配置是否有问题

配置详细信息:

  • Neo4j版本2.2.5
  • 服务器位于我的2014年中端笔记本电脑上,运行Ubuntu 15.04
  • OpenJDK 1.8版
  • 对服务器的呼叫也来自我的笔记本电脑(通过localhost:7474),因此不应该涉及任何网络延迟
  • 我通过Clojure/Neocons给neo4j打电话;使用的方法是clojurewerkz.neocons.rest.nodes类中的“create”
  • 使用密码似乎更慢;例如,通过HTML接口调用“PROFILE CREATE(you:Person{name:“Jane Doe”})返回“you”,返回“Cypher版本:Cypher 2.2,planner:RULE.5 54毫秒内的数据库总命中率”

另一种尝试是运行
/bin/neo4j shell
。因为没有HTTP连接,所以它可以帮助您了解Neo4j的数量以及HTTP接口的数量

在2.2.2上执行此操作时,我的
CREATE
s通常在10毫秒左右


我不确定理想的配置是什么,也不确定是否有可以提高性能的配置。

Neo4j性能特性是一个棘手的领域

测量性能 首先:这在很大程度上取决于服务器的配置方式。在笔记本电脑上测量任何东西都是错误的

在测量性能之前,您应检查以下各项:

  • 您有适当的服务器硬件()
  • 客户端和服务器位于本地网络中
  • Neo4j配置正确(内存映射、Web服务器线程池、java堆大小等)
  • 服务器已正确配置(Linux tcp堆栈、最大可用打开文件等)
  • 服务器已预热。Neo4j是用Java编写的,所以您应该在测量数字之前进行适当的预热(例如,进行约15分钟的加载)
  • 最后一个是企业版。Neo4j enterprise edition具有一些可以大大提高性能的高级功能(例如)

    Neo4j内部 Neo4j内部为:

    • 储藏
    • 核心API
    • 遍历API
    • 塞弗API
    所有操作都是在没有任何额外网络请求的情况下执行的。NeN4J <强> Server 是在这个坚实的基础之上构建的。

    因此,当您向Neo4j服务器发出请求时,您正在测量:

    • 客户端和服务器之间的延迟
    • JSON序列化成本
    • Web服务器(Jetty)
    • 用于管理锁、事务等的附加模块
    • 以及Neo4j本身
    所以,这里的底线是-Neo4j本身非常快,如果在嵌入式模式下使用的话。但处理Neo4j服务器需要额外的成本

    数字 我们进行了内部Neo4j测试。我们测量了几个案例

    创建节点 这里我们使用的是香草事务性Cypher restapi

    线程:2

    Node per transaction: 1000  
    Execution time: 1635  
    Total nodes created: 7000000  
    Nodes per second: 7070  
    
    线程:5

    Node per transaction: 750  
    Execution time: 852  
    Total nodes created: 7000000  
    Nodes per second: 8215  
    
    大型数据库同步 这一个使用定制开发,在服务器和客户机之间使用二进制协议,并具有一些并发性

    但这仍然是Neo4j服务器(实际上是Neo4j集群)

    这些数字显示了真正的Neo4j功率

    我的号码 我现在就试着测量性能

    新的和未配置的数据库(2.2.5),Ubuntu 14.04(VM)

    结果:

    $ ab -p post_loc.txt -T application/json -c 1 -n 10000 http://localhost:7474/db/data/node
    This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/
    
    Benchmarking localhost (be patient)
    Completed 1000 requests
    Completed 2000 requests
    Completed 3000 requests
    Completed 4000 requests
    Completed 5000 requests
    Completed 6000 requests
    Completed 7000 requests
    Completed 8000 requests
    Completed 9000 requests
    Completed 10000 requests
    Finished 10000 requests
    
    
    Server Software:        Jetty(9.2.4.v20141103)
    Server Hostname:        localhost
    Server Port:            7474
    
    Document Path:          /db/data/node
    Document Length:        1245 bytes
    
    Concurrency Level:      1
    Time taken for tests:   14.082 seconds
    Complete requests:      10000
    Failed requests:        0
    Total transferred:      14910000 bytes
    Total body sent:        1460000
    HTML transferred:       12450000 bytes
    Requests per second:    710.13 [#/sec] (mean)
    Time per request:       1.408 [ms] (mean)
    Time per request:       1.408 [ms] (mean, across all concurrent requests)
    Transfer rate:          1033.99 [Kbytes/sec] received
                            101.25 kb/s sent
                            1135.24 kb/s total
    
    Connection Times (ms)
                  min  mean[+/-sd] median   max
    Connect:        0    0   0.2      0      19
    Processing:     1    1   1.3      1      53
    Waiting:        0    1   1.2      1      53
    Total:          1    1   1.3      1      54
    
    Percentage of the requests served within a certain time (ms)
      50%      1
      66%      1
      75%      1
      80%      1
      90%      2
      95%      2
      98%      3
      99%      4
     100%     54 (longest request)
    
    $ab-p post_loc.txt-T application/json-c 1-n 10000http://localhost:7474/db/data/node
    这是ApacheBench,版本2.3
    版权1996亚当·特维斯,宙斯科技有限公司,http://www.zeustech.net/
    授权给Apache软件基金会,http://www.apache.org/
    对本地主机进行基准测试(耐心等待)
    完成了1000个请求
    已完成2000项请求
    已完成3000个请求
    已完成4000个请求
    已完成5000个请求
    已完成6000个请求
    已完成7000个请求
    已完成8000个请求
    已完成9000个请求
    已完成10000个请求
    完成了10000个请求
    服务器软件:Jetty(9.2.4.v20141103)
    服务器主机名:localhost
    服务器端口:7474
    文档路径:/db/数据/节点
    文件长度:1245字节
    并发级别:1
    测试时间:14.082秒
    完成申请:10000
    失败的请求:0
    传输总量:14910000字节
    发送总数:1460000
    传输的HTML:12450000字节
    每秒请求数:710.13[#秒](平均值)
    每次请求的时间:1.408[ms](平均值)
    每个请求的时间:1.408[ms](所有并发请求的平均时间)
    传输速率:接收到1033.99[千字节/秒]
    已发送101.25 kb/s
    总计1135.24 kb/s
    连接时间(毫秒)
    最小平均值[+/-sd]最大中值
    连接:0.2 0 19
    处理:1.3 1 53
    候补人数:011.2153
    总数:1.3 1 54
    在特定时间内服务的请求百分比(毫秒)
    50%      1
    66%      1
    75%      1
    80%      1
    90%      2
    95%      2
    98%      3
    99%      4
    100%54(最长请求)
    
    这一个使用RESTAPI创建10000个节点,在一个线程中没有属性

    如您所见,在Linux虚拟机中的我的笔记本电脑上的事件,使用默认设置-Neo4j能够在4ms或更短的时间内创建节点(99%)

    注意:我以前已经预热过数据库(创建和删除了100K个节点)

    插销 如果您正在寻找最佳的Neo4j性能,您应该遵循Bolt开发。这是Neo4j服务器的新二进制协议


    更多信息:,和。

    您可能还希望访问public slack group以获取以下方面的帮助:
    $ ab -p post_loc.txt -T application/json -c 1 -n 10000 http://localhost:7474/db/data/node
    This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/
    
    Benchmarking localhost (be patient)
    Completed 1000 requests
    Completed 2000 requests
    Completed 3000 requests
    Completed 4000 requests
    Completed 5000 requests
    Completed 6000 requests
    Completed 7000 requests
    Completed 8000 requests
    Completed 9000 requests
    Completed 10000 requests
    Finished 10000 requests
    
    
    Server Software:        Jetty(9.2.4.v20141103)
    Server Hostname:        localhost
    Server Port:            7474
    
    Document Path:          /db/data/node
    Document Length:        1245 bytes
    
    Concurrency Level:      1
    Time taken for tests:   14.082 seconds
    Complete requests:      10000
    Failed requests:        0
    Total transferred:      14910000 bytes
    Total body sent:        1460000
    HTML transferred:       12450000 bytes
    Requests per second:    710.13 [#/sec] (mean)
    Time per request:       1.408 [ms] (mean)
    Time per request:       1.408 [ms] (mean, across all concurrent requests)
    Transfer rate:          1033.99 [Kbytes/sec] received
                            101.25 kb/s sent
                            1135.24 kb/s total
    
    Connection Times (ms)
                  min  mean[+/-sd] median   max
    Connect:        0    0   0.2      0      19
    Processing:     1    1   1.3      1      53
    Waiting:        0    1   1.2      1      53
    Total:          1    1   1.3      1      54
    
    Percentage of the requests served within a certain time (ms)
      50%      1
      66%      1
      75%      1
      80%      1
      90%      2
      95%      2
      98%      3
      99%      4
     100%     54 (longest request)