Skip to content

Instantly share code, notes, and snippets.

@maxdemarzi
Forked from jexp/__numbers_31.txt
Last active December 8, 2021 10:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save maxdemarzi/e854dd9bce7a7900bec3 to your computer and use it in GitHub Desktop.
Save maxdemarzi/e854dd9bce7a7900bec3 to your computer and use it in GitHub Desktop.
Concurrent Neo4j Performance Tests via HTTP + Cypher (usage: ./_run_ab.sh 4 10000 create_plain.json)

Usage

Use latest Neo4j for best results, e.g. 2.2.2 or 2.3.0-M02 (http://neo4j.com/download) On a machine with 12 cores use concurrency 24

Create 1 node, 1 rel, 1 property per request, 1M requests

Total: 1M nodes, rels, props

./run_ab.sh 24 1000000 create_1.json

Results

Requests per second: 18881.14 [#/sec] (mean) → 19k nodes, rels, props / s Time taken for tests: 52.963 seconds → 1M / 52s = 19k / s

Server Software:        Jetty(9.2.4.v20141103)
Server Hostname:        127.0.0.1
Server Port:            7474

Document Path:          /db/data/transaction/commit
Document Length:        50 bytes

Concurrency Level:      24
Time taken for tests:   52.963 seconds
Complete requests:      1000000
Failed requests:        0
Keep-Alive requests:    1000000
Total transferred:      246000000 bytes
Total body sent:        276000000
HTML transferred:       50000000 bytes
Requests per second:    18881.14 [#/sec] (mean)
Time per request:       1.271 [ms] (mean)
Time per request:       0.053 [ms] (mean, across all concurrent requests)
Transfer rate:          4535.90 [Kbytes/sec] received
                        5089.06 kb/s sent
                        9624.96 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     0    1   0.9      1      82
Waiting:        0    1   0.9      1      82
Total:          0    1   0.9      1      82

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      1
  95%      1
  98%      2
  99%      3
 100%     82 (longest request)

create 100 node, 100 rel, 100 props per request, 100k requests

Total 10M nodes, rels, props

./run_ab.sh 24 100000 create_100.json

Results

Requests per second: 4809.64 [#/sec] (mean) → 480k nodes, rels, props / s Time taken for tests: 20.792 seconds → 10M / 21s = 480k / s

Server Software:        Jetty(9.2.4.v20141103)
Server Hostname:        127.0.0.1
Server Port:            7474

Document Path:          /db/data/transaction/commit
Document Length:        60 bytes

Concurrency Level:      24
Time taken for tests:   20.792 seconds
Complete requests:      100000
Failed requests:        0
Keep-Alive requests:    100000
Total transferred:      25600000 bytes
Total body sent:        30700000
HTML transferred:       6000000 bytes
Requests per second:    4809.64 [#/sec] (mean)
Time per request:       4.990 [ms] (mean)
Time per request:       0.208 [ms] (mean, across all concurrent requests)
Transfer rate:          1202.41 [Kbytes/sec] received
                        1441.95 kb/s sent
                        2644.37 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     1    5   8.3      5     208
Waiting:        1    5   8.3      5     208
Total:          1    5   8.3      5     208

Percentage of the requests served within a certain time (ms)
  50%      5
  66%      5
  75%      5
  80%      5
  90%      6
  95%      7
  98%     11
  99%     12
 100%    208 (longest request)

Lookup by property

./_run_ab.sh 24 100000 simple_lookup_property.json 12474
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Completed 100000 requests
Finished 100000 requests


Server Software:        Jetty(9.2.4.v20141103)
Server Hostname:        127.0.0.1
Server Port:            12474

Document Path:          /db/data/transaction/commit
Document Length:        114 bytes

Concurrency Level:      24
Time taken for tests:   3.364 seconds
Complete requests:      100000
Failed requests:        0
Keep-Alive requests:    100000
Total transferred:      31100000 bytes
Total body sent:        31800000
HTML transferred:       11400000 bytes
Requests per second:    29730.25 [#/sec] (mean)
Time per request:       0.807 [ms] (mean)
Time per request:       0.034 [ms] (mean, across all concurrent requests)
Transfer rate:          9029.40 [Kbytes/sec] received
                        9232.64 kb/s sent
                        18262.04 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     0    1   3.6      1     199
Waiting:        0    1   3.6      1     199
Total:          0    1   3.6      1     199

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      1
  95%      2
  98%      4
  99%      5
 100%    199 (longest request)

Lookup by id

./_run_ab.sh 24 100000 simple_lookup.json 12474
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Completed 100000 requests
Finished 100000 requests


Server Software:        Jetty(9.2.4.v20141103)
Server Hostname:        127.0.0.1
Server Port:            12474

Document Path:          /db/data/transaction/commit
Document Length:        69 bytes

Concurrency Level:      24
Time taken for tests:   1.911 seconds
Complete requests:      100000
Failed requests:        0
Keep-Alive requests:    100000
Total transferred:      26500000 bytes
Total body sent:        31100000
HTML transferred:       6900000 bytes
Requests per second:    52318.60 [#/sec] (mean)
Time per request:       0.459 [ms] (mean)
Time per request:       0.019 [ms] (mean, across all concurrent requests)
Transfer rate:          13539.48 [Kbytes/sec] received
                        15889.73 kb/s sent
                        29429.21 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     0    0   1.7      0      95
Waiting:        0    0   1.7      0      95
Total:          0    0   1.7      0      95

Percentage of the requests served within a certain time (ms)
  50%      0
  66%      0
  75%      1
  80%      1
  90%      1
  95%      1
  98%      1
  99%      1
 100%     95 (longest request)
function run {
echo "{\"statements\":[{\"statement\":\"$1\"}]}" > perf_test.json
echo "Query: $1" >> perf_results.txt
ab -c ${3-4} -n ${2-10000} -p perf_test.json -T application/json -A neo4j:$4 -H accept:application/json http://127.0.0.1:7474/db/data/transaction/commit | tee -a perf_results.txt
}
CONCURRENCY=4
REQUESTS=10000
PWD=admin
echo "Performance Test Northwind: concurrency $CONCURRENCY requests: $REQUESTS " > perf_results.txt
run 'MATCH (c:Category {categoryName:'Produce'})<--(:Product)<--(s:Supplier) RETURN DISTINCT s.companyName as ProduceSuppliers' $REQUESTS $CONCURRENCY $PWD
run 'MATCH (s:Supplier)-->(:Product)-->(c:Category) RETURN s.companyName as Company, collect(distinct c.categoryName) as Categories' $REQUESTS $CONCURRENCY $PWD
run 'MATCH (cust:Customer)-[:PURCHASED]->(:Order)-[o:ORDERS]->(p:Product), (p)-[:PART_OF]->(c:Category {categoryName:"Produce"}) RETURN DISTINCT cust.contactName as CustomerName, SUM(o.quantity) AS TotalProductsPurchased' $REQUESTS $CONCURRENCY $PWD
# usage ./_run_ab.sh 4 10000 create_plain.json
CONCURRENT=${1-10}
REQUESTS=${2-10000}
COMMAND=${3-postquery.json}
PORT=${4-7474}
ab $AB_OPTS -k -c $CONCURRENT -n $REQUESTS -p $COMMAND -T application/json -H accept:application/json http://127.0.0.1:${PORT}/db/data/transaction/commit
{"statements":[{"statement":"CREATE (_0 {type:'Bike'}), (_0)-[:REL]->(_0)"}]}
{"statements":[{"statement":"FOREACH (r in range(1,100) | CREATE (_0 {type:'Bike'}), (_0)-[:REL]->(_0))"}]}
{"statements":[{"statement":"CREATE (_0:`Bike`), (_1:`Wheel`), (_2:`Wheel`), (_0)-[:WHEELS]->(_1), (_0)-[:WHEELS]->(_2) RETURN id(_0) AS _0, id(_1) AS _1, id(_2) AS _2","parameters":{},"resultDataContents":["row"]}]}
{"statements":[{"statement":"CREATE (_0 {type:'Bike'}), (_1 {type:'Wheel'}), (_2 {type:'Wheel'}), (_0)-[:WHEELS]->(_1), (_0)-[:WHEELS]->(_2) RETURN id(_0) AS _0, id(_1) AS _1, id(_2) AS _2","parameters":{},"resultDataContents":["row"]}]}
{"statements":[{"statement":"MATCH (me:User {username:'Kaylee83639'})-[:FRIENDS]-(people:User)-[:FRIENDS]-(fof:User) WHERE me <> fof and not(me)-[:FRIENDS]-(fof) return fof,count(*) as freq order by freq desc limit 10;"}]}
{"statements":[{"statement":"MATCH (me:User {username:'Kaylee83639'})-[:FRIENDS]-(people) RETURN people.username"}]}
{"statements":[{"statement":"MATCH (n) WHERE id(n) = 10 return id(n)"}]}
{"statements":[{"statement":"MATCH (n:Tag) WHERE n.tagId = 'neo4j' return n"}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment