Skip to content

Instantly share code, notes, and snippets.

@jadell
Created October 25, 2013 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jadell/7163338 to your computer and use it in GitHub Desktop.
Save jadell/7163338 to your computer and use it in GitHub Desktop.
Performance benchmarks of neo4jphp streaming header vs. no streaming header, using curl and file stream transports
<?php
use Everyman\Neo4j\Client,
Everyman\Neo4j\Transport\Stream,
Everyman\Neo4j\Transport\Curl,
Everyman\Neo4j\Cypher\Query;
require_once 'example_bootstrap.php';
$transport = new Stream();
// $transport = new Curl();
$client = new Client($transport);
echo "Stream transport, streaming\n";
print_r($client->getServerInfo());
$runs = 100;
$total = 0;
foreach (range(1, $runs) as $i) {
$start = microtime(true);
$queryA = new Query($client, 'MATCH n RETURN n');
$result = $queryA->getResultSet();
$subtotal = microtime(true) - $start;
$total += $subtotal;
echo "Run ".($i).": $subtotal\n";
}
echo "Retrieved " . count($result) . " nodes " . $runs . " times in " . $total . " seconds [". ($total/$runs) ." avg]\n";
Curl transport, streaming
Array
(
[extensions] => Array
(
)
[node] => http://localhost:7474/db/data/node
[node_index] => http://localhost:7474/db/data/index/node
[relationship_index] => http://localhost:7474/db/data/index/relationship
[extensions_info] => http://localhost:7474/db/data/ext
[relationship_types] => http://localhost:7474/db/data/relationship/types
[batch] => http://localhost:7474/db/data/batch
[cypher] => http://localhost:7474/db/data/cypher
[transaction] => http://localhost:7474/db/data/transaction
[neo4j_version] => 2.0.0-M06
[version] => Array
(
[full] => 2.0.0-M06
[major] => 2
[minor] => 0
[release] => 0
)
)
Run 1: 1.3773171901703
Run 2: 1.2345998287201
Run 3: 1.2152161598206
Run 4: 1.2166080474854
Run 5: 1.1906969547272
Run 6: 1.0887129306793
Run 7: 1.0566709041595
Run 8: 1.079980134964
Run 9: 1.2117731571198
Run 10: 1.0999689102173
Run 11: 1.0503377914429
Run 12: 1.0669620037079
Run 13: 1.0578329563141
Run 14: 1.0427570343018
Run 15: 1.0627501010895
Run 16: 1.0864689350128
Run 17: 1.0940001010895
Run 18: 1.1163761615753
Run 19: 1.0896079540253
Run 20: 1.0637590885162
Run 21: 1.1013789176941
Run 22: 1.0713949203491
Run 23: 1.0955641269684
Run 24: 1.068167924881
Run 25: 1.1061308383942
Run 26: 1.0768039226532
Run 27: 1.1032450199127
Run 28: 1.0994298458099
Run 29: 1.0702979564667
Run 30: 1.0809881687164
Run 31: 1.0896039009094
Run 32: 1.1065049171448
Run 33: 1.1168920993805
Run 34: 1.0991189479828
Run 35: 1.1108679771423
Run 36: 1.1207621097565
Run 37: 1.0658190250397
Run 38: 1.0986847877502
Run 39: 1.0960071086884
Run 40: 1.0944700241089
Run 41: 1.0876059532166
Run 42: 1.075413942337
Run 43: 1.0748569965363
Run 44: 1.0766718387604
Run 45: 1.1280608177185
Run 46: 1.0867819786072
Run 47: 1.0839731693268
Run 48: 1.0857450962067
Run 49: 1.123939037323
Run 50: 1.0930240154266
Run 51: 1.080283164978
Run 52: 1.0952930450439
Run 53: 1.1168150901794
Run 54: 1.1283009052277
Run 55: 1.1297760009766
Run 56: 1.122386932373
Run 57: 1.1169939041138
Run 58: 1.0794019699097
Run 59: 1.0843901634216
Run 60: 1.1365730762482
Run 61: 1.1649451255798
Run 62: 1.1595690250397
Run 63: 1.1678609848022
Run 64: 1.1940381526947
Run 65: 1.188707113266
Run 66: 1.1790599822998
Run 67: 1.1692378520966
Run 68: 1.1704139709473
Run 69: 1.1631500720978
Run 70: 1.1780760288239
Run 71: 1.1708788871765
Run 72: 1.235692024231
Run 73: 1.1049749851227
Run 74: 1.1504821777344
Run 75: 1.139536857605
Run 76: 1.1299550533295
Run 77: 1.1112101078033
Run 78: 1.0802090167999
Run 79: 1.1222860813141
Run 80: 1.0803580284119
Run 81: 1.0900409221649
Run 82: 1.1074829101562
Run 83: 1.0757730007172
Run 84: 1.0777809619904
Run 85: 1.1384699344635
Run 86: 1.1312851905823
Run 87: 1.1028909683228
Run 88: 1.1541800498962
Run 89: 1.1303720474243
Run 90: 1.2201099395752
Run 91: 1.1206459999084
Run 92: 1.1494851112366
Run 93: 1.142655134201
Run 94: 1.1651999950409
Run 95: 1.1411030292511
Run 96: 1.1099009513855
Run 97: 1.1630680561066
Run 98: 1.1331670284271
Run 99: 1.1304609775543
Run 100: 1.1256020069122
Retrieved 31064 nodes 100 times in 112.05113172531 seconds [1.1205113172531 avg]
Curl transport, no streaming
Array
(
[extensions] => Array
(
)
[node] => http://localhost:7474/db/data/node
[node_index] => http://localhost:7474/db/data/index/node
[relationship_index] => http://localhost:7474/db/data/index/relationship
[extensions_info] => http://localhost:7474/db/data/ext
[relationship_types] => http://localhost:7474/db/data/relationship/types
[batch] => http://localhost:7474/db/data/batch
[cypher] => http://localhost:7474/db/data/cypher
[transaction] => http://localhost:7474/db/data/transaction
[neo4j_version] => 2.0.0-M06
[version] => Array
(
[full] => 2.0.0-M06
[major] => 2
[minor] => 0
[release] => 0
)
)
Run 1: 1.6613688468933
Run 2: 2.1714751720428
Run 3: 1.7101149559021
Run 4: 1.6819438934326
Run 5: 1.7074840068817
Run 6: 1.9652969837189
Run 7: 1.5125868320465
Run 8: 1.7046630382538
Run 9: 1.5832839012146
Run 10: 1.5307879447937
Run 11: 1.6349020004272
Run 12: 1.5927209854126
Run 13: 2.0484669208527
Run 14: 1.6308860778809
Run 15: 1.5926280021667
Run 16: 1.613018989563
Run 17: 1.6416211128235
Run 18: 1.671010017395
Run 19: 1.6045749187469
Run 20: 1.5604059696198
Run 21: 1.6451480388641
Run 22: 1.6443619728088
Run 23: 1.6683990955353
Run 24: 1.7196450233459
Run 25: 1.7085709571838
Run 26: 1.7337191104889
Run 27: 1.7422938346863
Run 28: 2.1595530509949
Run 29: 1.6523330211639
Run 30: 1.8457000255585
Run 31: 1.6670370101929
Run 32: 1.6816401481628
Run 33: 1.7264430522919
Run 34: 2.1584990024567
Run 35: 1.631774187088
Run 36: 1.8922531604767
Run 37: 2.227147102356
Run 38: 1.789813041687
Run 39: 1.7593581676483
Run 40: 1.8682491779327
Run 41: 2.2737400531769
Run 42: 1.7790260314941
Run 43: 1.7347400188446
Run 44: 1.687068939209
Run 45: 2.1741600036621
Run 46: 1.7660360336304
Run 47: 1.749979019165
Run 48: 1.6696629524231
Run 49: 1.7113738059998
Run 50: 1.7464120388031
Run 51: 2.1175620555878
Run 52: 1.7227869033813
Run 53: 1.6814451217651
Run 54: 1.9230749607086
Run 55: 2.1536569595337
Run 56: 1.7675180435181
Run 57: 1.7572128772736
Run 58: 1.8002181053162
Run 59: 2.1308488845825
Run 60: 1.728376865387
Run 61: 1.6752369403839
Run 62: 1.9663500785828
Run 63: 2.2295970916748
Run 64: 1.7490570545197
Run 65: 1.7319548130035
Run 66: 1.6882400512695
Run 67: 2.1902899742126
Run 68: 1.7239429950714
Run 69: 1.630234003067
Run 70: 1.5923411846161
Run 71: 1.6154310703278
Run 72: 2.2801508903503
Run 73: 1.6933870315552
Run 74: 1.8337559700012
Run 75: 2.0718278884888
Run 76: 1.7075328826904
Run 77: 1.6764850616455
Run 78: 1.6929848194122
Run 79: 1.6714100837708
Run 80: 1.7460107803345
Run 81: 1.7401349544525
Run 82: 1.7897789478302
Run 83: 1.7306380271912
Run 84: 1.7304480075836
Run 85: 1.8086280822754
Run 86: 2.1500670909882
Run 87: 1.6213848590851
Run 88: 1.8739659786224
Run 89: 1.6801130771637
Run 90: 1.9026730060577
Run 91: 1.6514790058136
Run 92: 2.0959770679474
Run 93: 1.6515619754791
Run 94: 1.7133240699768
Run 95: 1.6802279949188
Run 96: 2.0028049945831
Run 97: 1.5841012001038
Run 98: 1.8544759750366
Run 99: 1.6613891124725
Run 100: 1.6554329395294
Retrieved 31064 nodes 100 times in 178.56090545654 seconds [1.7856090545654 avg]
Stream transport, streaming
Array
(
[extensions] => Array
(
)
[node] => http://localhost:7474/db/data/node
[node_index] => http://localhost:7474/db/data/index/node
[relationship_index] => http://localhost:7474/db/data/index/relationship
[extensions_info] => http://localhost:7474/db/data/ext
[relationship_types] => http://localhost:7474/db/data/relationship/types
[batch] => http://localhost:7474/db/data/batch
[cypher] => http://localhost:7474/db/data/cypher
[transaction] => http://localhost:7474/db/data/transaction
[neo4j_version] => 2.0.0-M06
[version] => Array
(
[full] => 2.0.0-M06
[major] => 2
[minor] => 0
[release] => 0
)
)
Run 1: 1.0286500453949
Run 2: 1.1158699989319
Run 3: 1.1003730297089
Run 4: 1.1122441291809
Run 5: 1.0514039993286
Run 6: 1.0672128200531
Run 7: 1.0990262031555
Run 8: 1.0678300857544
Run 9: 1.0811760425568
Run 10: 1.1257801055908
Run 11: 1.0962650775909
Run 12: 1.1349129676819
Run 13: 1.1063649654388
Run 14: 1.0806369781494
Run 15: 1.0720570087433
Run 16: 1.0869741439819
Run 17: 1.0578110218048
Run 18: 1.0536868572235
Run 19: 1.0593550205231
Run 20: 1.1068160533905
Run 21: 1.1269500255585
Run 22: 1.1030061244965
Run 23: 1.1105320453644
Run 24: 1.1263408660889
Run 25: 1.1231269836426
Run 26: 1.0809149742126
Run 27: 1.0814697742462
Run 28: 1.0671961307526
Run 29: 1.0935699939728
Run 30: 1.0932941436768
Run 31: 1.1039669513702
Run 32: 1.079174041748
Run 33: 1.1321120262146
Run 34: 1.108286857605
Run 35: 1.1062710285187
Run 36: 1.1184968948364
Run 37: 1.1420991420746
Run 38: 1.0836169719696
Run 39: 1.1313900947571
Run 40: 1.1409120559692
Run 41: 1.0901291370392
Run 42: 1.1431879997253
Run 43: 1.148365020752
Run 44: 1.1149230003357
Run 45: 1.1102588176727
Run 46: 1.0899338722229
Run 47: 1.1184890270233
Run 48: 1.1392440795898
Run 49: 1.09095287323
Run 50: 1.1165919303894
Run 51: 1.1018180847168
Run 52: 1.0625550746918
Run 53: 1.0755469799042
Run 54: 1.0477991104126
Run 55: 1.0601060390472
Run 56: 1.0879209041595
Run 57: 1.0760490894318
Run 58: 1.0683310031891
Run 59: 1.064493894577
Run 60: 1.0662651062012
Run 61: 1.1090140342712
Run 62: 1.1092898845673
Run 63: 1.0717220306396
Run 64: 1.0865619182587
Run 65: 1.0806379318237
Run 66: 1.0925650596619
Run 67: 1.0887758731842
Run 68: 1.0801200866699
Run 69: 1.0760409832001
Run 70: 1.0763049125671
Run 71: 1.1124348640442
Run 72: 1.0886609554291
Run 73: 1.1501400470734
Run 74: 1.1143379211426
Run 75: 1.1400420665741
Run 76: 1.1343779563904
Run 77: 1.1279730796814
Run 78: 1.1254410743713
Run 79: 1.1092081069946
Run 80: 1.0867578983307
Run 81: 1.1073110103607
Run 82: 1.1011040210724
Run 83: 1.1352200508118
Run 84: 1.1130678653717
Run 85: 1.155886888504
Run 86: 1.1626191139221
Run 87: 1.1193771362305
Run 88: 1.1563339233398
Run 89: 1.1685039997101
Run 90: 1.1191029548645
Run 91: 1.1028130054474
Run 92: 1.1287891864777
Run 93: 1.0989460945129
Run 94: 1.1128611564636
Run 95: 1.0995609760284
Run 96: 1.0915560722351
Run 97: 1.1273350715637
Run 98: 1.117705821991
Run 99: 1.1209919452667
Run 100: 1.1467878818512
Retrieved 31064 nodes 100 times in 110.27641558647 seconds [1.1027641558647 avg]
Stream transport, no streaming
Array
(
[extensions] => Array
(
)
[node] => http://localhost:7474/db/data/node
[node_index] => http://localhost:7474/db/data/index/node
[relationship_index] => http://localhost:7474/db/data/index/relationship
[extensions_info] => http://localhost:7474/db/data/ext
[relationship_types] => http://localhost:7474/db/data/relationship/types
[batch] => http://localhost:7474/db/data/batch
[cypher] => http://localhost:7474/db/data/cypher
[transaction] => http://localhost:7474/db/data/transaction
[neo4j_version] => 2.0.0-M06
[version] => Array
(
[full] => 2.0.0-M06
[major] => 2
[minor] => 0
[release] => 0
)
)
Run 1: 1.6311531066895
Run 2: 1.7365200519562
Run 3: 1.7084331512451
Run 4: 1.9815301895142
Run 5: 1.6538908481598
Run 6: 1.9394011497498
Run 7: 1.7130091190338
Run 8: 1.727609872818
Run 9: 1.7342460155487
Run 10: 1.799332857132
Run 11: 1.7947809696198
Run 12: 1.722366809845
Run 13: 1.8195369243622
Run 14: 1.9822030067444
Run 15: 1.6711280345917
Run 16: 1.870020866394
Run 17: 2.1265971660614
Run 18: 1.7774260044098
Run 19: 1.7251629829407
Run 20: 1.9702482223511
Run 21: 2.2163109779358
Run 22: 1.7309169769287
Run 23: 1.6659038066864
Run 24: 1.7088990211487
Run 25: 1.6380178928375
Run 26: 2.1593329906464
Run 27: 1.6859910488129
Run 28: 2.0810708999634
Run 29: 1.6783351898193
Run 30: 1.7694199085236
Run 31: 2.1427059173584
Run 32: 1.818500995636
Run 33: 1.7652740478516
Run 34: 1.9464020729065
Run 35: 1.7790539264679
Run 36: 1.9511399269104
Run 37: 1.7863531112671
Run 38: 1.9378190040588
Run 39: 2.332405090332
Run 40: 1.8411991596222
Run 41: 1.7589168548584
Run 42: 1.9953689575195
Run 43: 1.7706429958344
Run 44: 1.9539449214935
Run 45: 1.7864401340485
Run 46: 2.0524840354919
Run 47: 2.3573169708252
Run 48: 1.7884860038757
Run 49: 1.8074338436127
Run 50: 1.7379660606384
Run 51: 1.7921149730682
Run 52: 1.8430922031403
Run 53: 1.6667408943176
Run 54: 1.7539660930634
Run 55: 1.6740460395813
Run 56: 1.7528259754181
Run 57: 2.1834261417389
Run 58: 1.8225519657135
Run 59: 1.7448320388794
Run 60: 1.8738698959351
Run 61: 2.1902151107788
Run 62: 1.8405070304871
Run 63: 1.7252669334412
Run 64: 1.9460928440094
Run 65: 2.2913510799408
Run 66: 1.8907330036163
Run 67: 1.8004260063171
Run 68: 1.8503358364105
Run 69: 1.7738900184631
Run 70: 1.7951929569244
Run 71: 1.7773871421814
Run 72: 2.062344789505
Run 73: 1.7568809986115
Run 74: 2.0793359279633
Run 75: 1.7931201457977
Run 76: 2.0223269462585
Run 77: 1.8245170116425
Run 78: 2.0644240379333
Run 79: 2.3407599925995
Run 80: 1.8311100006104
Run 81: 1.757609128952
Run 82: 2.0639388561249
Run 83: 2.2863030433655
Run 84: 1.9051580429077
Run 85: 1.8063099384308
Run 86: 2.0206210613251
Run 87: 2.2385609149933
Run 88: 1.9388809204102
Run 89: 1.8647689819336
Run 90: 1.7703399658203
Run 91: 1.7909882068634
Run 92: 2.1563069820404
Run 93: 1.7449440956116
Run 94: 1.8246610164642
Run 95: 1.8002769947052
Run 96: 1.7064440250397
Run 97: 2.1762268543243
Run 98: 1.7644901275635
Run 99: 1.7793011665344
Run 100: 1.7176377773285
Retrieved 31064 nodes 100 times in 187.60610222816 seconds [1.8760610222816 avg]
Server info:
[neo4j_version] => 2.0.0-M06
[version] => Array
Linux 3.5.0-41-generic x86_64
Ubuntu 12.10 quantal
Curl, no streaming: Retrieved 31064 nodes 100 times in 178.56090545654 seconds [1.7856090545654 avg] +61%
Stream, no streaming: Retrieved 31064 nodes 100 times in 187.60610222816 seconds [1.8760610222816 avg] +70%
Curl, streaming: Retrieved 31064 nodes 100 times in 112.05113172531 seconds [1.1205113172531 avg] + 1%
Stream, streaming: Retrieved 31064 nodes 100 times in 110.27641558647 seconds [1.1027641558647 avg]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment