@@ -491,8 +491,15 @@ client.multi([
491
491
console .log (replies);
492
492
});
493
493
```
494
+
495
+ ### Multi.exec_atomic( callback )
496
+
497
+ Identical to Multi.exec but with the difference that executing a single command will not use transactions.
498
+
494
499
## client.batch([ commands] )
495
500
501
+ Identical to .multi without transactions. This is recommended if you want to execute many commands at once but don't have to rely on transactions.
502
+
496
503
` BATCH ` commands are queued up until an ` EXEC ` is issued, and then all commands are run atomically by
497
504
Redis. The interface in ` node_redis ` is to return an individual ` Batch ` object by calling ` client.batch() ` .
498
505
The only difference between .batch and .multi is that no transaction is going to be used.
@@ -643,55 +650,55 @@ Here are results of `multi_bench.js` which is similar to `redis-benchmark` from
643
650
hiredis parser (Lenovo T450s i7-5600U):
644
651
645
652
Client count: 5, node version: 4.1.2, server version: 3.0.3, parser: hiredis
646
- PING, 1/5 min/max/avg/p95: 0/ 5 / 0.03 / 0.00 1537ms total, 32530.90 ops/sec
647
- PING, 50/5 min/max/avg/p95: 0/ 4 / 0.49 / 1.00 491ms total, 101832.99 ops/sec
648
- PING, batch 50/5 min/max/avg/p95: 0/ 2 / 0.17 / 1.00 178ms total, 280898.88 ops/sec
649
- SET 4B str, 1/5 min/max/avg/p95: 0/ 2/ 0.03/ 0.00 1400ms total, 35714.29 ops/sec
650
- SET 4B str, 50/5 min/max/avg/p95: 0/ 3 / 0.61 / 1.00 610ms total, 81967.21 ops/sec
651
- SET 4B str, batch 50/5 min/max/avg/p95: 0/ 1/ 0.19/ 1.00 198ms total, 252525.25 ops/sec
652
- SET 4B buf, 1/5 min/max/avg/p95: 0/ 3 / 0.05/ 0 .00 2349ms total, 21285.65 ops/sec
653
- SET 4B buf, 50/5 min/max/avg/p95: 0/ 5/ 1.63 / 3.00 1632ms total, 30637.25 ops/sec
654
- SET 4B buf, batch 50/5 min/max/avg/p95: 0/ 1 / 0.37 / 1.00 366ms total, 136612.02 ops/sec
655
- GET 4B str, 1/5 min/max/avg/p95: 0/ 3 / 0.03/ 0.00 1348ms total, 37091.99 ops/sec
656
- GET 4B str, 50/5 min/max/avg/p95: 0/ 3/ 0.51 / 1.00 513ms total, 97465.89 ops/sec
657
- GET 4B str, batch 50/5 min/max/avg/p95: 0/ 1/ 0.18 / 1.00 177ms total, 282485.88 ops/sec
658
- GET 4B buf, 1/5 min/max/avg/p95: 0/ 3 / 0.03/ 0.00 1336ms total, 37425.15 ops/sec
659
- GET 4B buf, 50/5 min/max/avg/p95: 0/ 4 / 0.52/ 1.00 525ms total, 95238.10 ops/sec
660
- GET 4B buf, batch 50/5 min/max/avg/p95: 0/ 1/ 0.18 / 1.00 177ms total, 282485.88 ops/sec
661
- SET 4KiB str, 1/5 min/max/avg/p95: 0/ 2 / 0.03/ 0.00 1674ms total, 29868.58 ops/sec
662
- SET 4KiB str, 50/5 min/max/avg/p95: 0/ 3 / 0.77 / 1 .00 775ms total, 64516.13 ops/sec
663
- SET 4KiB str, batch 50/5 min/max/avg/p95: 0/ 3 / 0.50 / 1.00 500ms total, 100000.00 ops/sec
664
- SET 4KiB buf, 1/5 min/max/avg/p95: 0/ 2 / 0.05/ 0.00 2410ms total, 20746.89 ops/sec
665
- SET 4KiB buf, 50/5 min/max/avg/p95: 0/ 5/ 1.64 / 3.00 1643ms total, 30432.14 ops/sec
666
- SET 4KiB buf, batch 50/5 min/max/avg/p95: 0/ 1/ 0.41/ 1.00 409ms total, 122249.39 ops/sec
667
- GET 4KiB str, 1/5 min/max/avg/p95: 0/ 2 / 0.03/ 0.00 1422ms total, 35161.74 ops/sec
668
- GET 4KiB str, 50/5 min/max/avg/p95: 0/ 4 / 0.68 / 1.00 680ms total, 73529.41 ops/sec
669
- GET 4KiB str, batch 50/5 min/max/avg/p95: 0/ 2/ 0.39 / 1.00 391ms total, 127877.24 ops/sec
670
- GET 4KiB buf, 1/5 min/max/avg/p95: 0/ 1 / 0.03/ 0.00 1420ms total, 35211.27 ops/sec
671
- GET 4KiB buf, 50/5 min/max/avg/p95: 0/ 4 / 0.68 / 1 .00 681ms total, 73421.44 ops/sec
672
- GET 4KiB buf, batch 50/5 min/max/avg/p95: 0/ 2/ 0.39/ 1.00 387ms total, 129198.97 ops/sec
673
- INCR, 1/5 min/max/avg/p95: 0/ 2/ 0.03/ 0.00 1334ms total, 37481.26 ops/sec
674
- INCR, 50/5 min/max/avg/p95: 0/ 4 / 0.51 / 1.00 513ms total, 97465.89 ops/sec
675
- INCR, batch 50/5 min/max/avg/p95: 0/ 1/ 0.18 / 1.00 179ms total, 279329.61 ops/sec
676
- LPUSH, 1/5 min/max/avg/p95: 0/ 2 / 0.03/ 0.00 1351ms total, 37009.62 ops/sec
677
- LPUSH, 50/5 min/max/avg/p95: 0/ 3/ 0.52 / 1.00 521ms total, 95969.29 ops/sec
678
- LPUSH, batch 50/5 min/max/avg/p95: 0/ 2 / 0.20 / 1.00 200ms total, 250000.00 ops/sec
679
- LRANGE 10, 1/5 min/max/avg/p95: 0/ 1 / 0.03/ 0.00 1562ms total, 32010.24 ops/sec
680
- LRANGE 10, 50/5 min/max/avg/p95: 0/ 4 / 0.69 / 1.00 690ms total, 72463.77 ops/sec
681
- LRANGE 10, batch 50/5 min/max/avg/p95: 0/ 2 / 0.39 / 1.00 393ms total, 127226.46 ops/sec
682
- LRANGE 100, 1/5 min/max/avg/p95: 0/ 3 / 0.06/ 1.00 3009ms total, 16616.82 ops/sec
683
- LRANGE 100, 50/5 min/max/avg/p95: 0/ 5/ 1.85 / 3.00 1850ms total, 27027.03 ops/sec
684
- LRANGE 100, batch 50/5 min/max/avg/p95: 2/ 4/ 2.15 / 3.00 2153ms total, 23223.41 ops/sec
685
- SET 4MiB buf, 1/5 min/max/avg/p95: 1/ 5 / 1.91 / 3.00 957ms total, 522.47 ops/sec
686
- SET 4MiB buf, 50 /5 min/max/avg/p95: 13/ 109 / 94.20/ 102 .00 987ms total, 506.59 ops/sec
687
- SET 4MiB buf, batch 50 /5 min/max/avg/p95: 90/ 107 / 93.10/ 107.00 931ms total, 537.06 ops/sec
688
- GET 4MiB str, 1/5 min/max/avg/p95: 4/ 16 / 5.97 / 10.00 598ms total, 167.22 ops/sec
689
- GET 4MiB str, 50 /5 min/max/avg/p95: 10/ 249/ 179.47/ 231.90 454ms total, 220.26 ops/sec
690
- GET 4MiB str, batch 50 /5 min/max/avg/p95: 215/ 226/ 220.50/ 226 .00 441ms total, 226.76 ops/sec
691
- GET 4MiB buf, 1/5 min/max/avg/p95: 3 / 26 / 6.55 / 11.95 658ms total, 151.98 ops/sec
692
- GET 4MiB buf, 50 /5 min/max/avg/p95: 11/ 265/ 186.73/ 241.90 469ms total, 213.22 ops/sec
693
- GET 4MiB buf, batch 50 /5 min/max/avg/p95: 226/ 247/ 236.50/ 247 .00 473ms total, 211.42 ops/sec
694
- End of tests. Total time elapsed: 44952 ms
653
+ PING, 1/5 min/max/avg/p95: 0/ 4 / 0.02 / 0.00 1223ms total, 40883.07 ops/sec
654
+ PING, 50/5 min/max/avg/p95: 0/ 3 / 0.50 / 1.00 497ms total, 100603.62 ops/sec
655
+ PING, batch 50/5 min/max/avg/p95: 0/ 1 / 0.15 / 1.00 308ms total, 324675.32 ops/sec
656
+ SET 4B str, 1/5 min/max/avg/p95: 0/ 2/ 0.03/ 0.00 1402ms total, 35663.34 ops/sec
657
+ SET 4B str, 50/5 min/max/avg/p95: 0/ 2 / 0.53 / 1.00 534ms total, 93632.96 ops/sec
658
+ SET 4B str, batch 50/5 min/max/avg/p95: 0/ 1/ 0.19/ 1.00 392ms total, 255102.04 ops/sec
659
+ SET 4B buf, 1/5 min/max/avg/p95: 0/ 2 / 0.05/ 1 .00 2433ms total, 20550.76 ops/sec
660
+ SET 4B buf, 50/5 min/max/avg/p95: 0/ 5/ 1.65 / 3.00 1652ms total, 30266.34 ops/sec
661
+ SET 4B buf, batch 50/5 min/max/avg/p95: 0/ 3 / 0.36 / 1.00 726ms total, 137741.05 ops/sec
662
+ GET 4B str, 1/5 min/max/avg/p95: 0/ 1 / 0.03/ 0.00 1314ms total, 38051.75 ops/sec
663
+ GET 4B str, 50/5 min/max/avg/p95: 0/ 3/ 0.53 / 1.00 529ms total, 94517.96 ops/sec
664
+ GET 4B str, batch 50/5 min/max/avg/p95: 0/ 1/ 0.16 / 1.00 328ms total, 304878.05 ops/sec
665
+ GET 4B buf, 1/5 min/max/avg/p95: 0/ 2 / 0.03/ 0.00 1389ms total, 35997.12 ops/sec
666
+ GET 4B buf, 50/5 min/max/avg/p95: 0/ 2 / 0.52/ 1.00 519ms total, 96339.11 ops/sec
667
+ GET 4B buf, batch 50/5 min/max/avg/p95: 0/ 1/ 0.16 / 1.00 168ms total, 297619.05 ops/sec
668
+ SET 4KiB str, 1/5 min/max/avg/p95: 0/ 3 / 0.03/ 0.00 1670ms total, 29940.12 ops/sec
669
+ SET 4KiB str, 50/5 min/max/avg/p95: 0/ 5 / 0.94 / 2 .00 941ms total, 53134.96 ops/sec
670
+ SET 4KiB str, batch 50/5 min/max/avg/p95: 0/ 2 / 0.49 / 1.00 984ms total, 101626.02 ops/sec
671
+ SET 4KiB buf, 1/5 min/max/avg/p95: 0/ 1 / 0.05/ 0.00 2423ms total, 20635.58 ops/sec
672
+ SET 4KiB buf, 50/5 min/max/avg/p95: 0/ 5/ 1.60 / 3.00 1598ms total, 31289.11 ops/sec
673
+ SET 4KiB buf, batch 50/5 min/max/avg/p95: 0/ 1/ 0.41/ 1.00 825ms total, 121212.12 ops/sec
674
+ GET 4KiB str, 1/5 min/max/avg/p95: 0/ 1 / 0.03/ 0.00 1483ms total, 33715.44 ops/sec
675
+ GET 4KiB str, 50/5 min/max/avg/p95: 0/ 3 / 0.69 / 1.00 691ms total, 72358.90 ops/sec
676
+ GET 4KiB str, batch 50/5 min/max/avg/p95: 0/ 2/ 0.38 / 1.00 759ms total, 131752.31 ops/sec
677
+ GET 4KiB buf, 1/5 min/max/avg/p95: 0/ 3 / 0.03/ 0.00 1485ms total, 33670.03 ops/sec
678
+ GET 4KiB buf, 50/5 min/max/avg/p95: 0/ 3 / 0.80 / 2 .00 797ms total, 62735.26 ops/sec
679
+ GET 4KiB buf, batch 50/5 min/max/avg/p95: 0/ 2/ 0.39/ 1.00 396ms total, 126262.63 ops/sec
680
+ INCR, 1/5 min/max/avg/p95: 0/ 2/ 0.03/ 0.00 1376ms total, 36337.21 ops/sec
681
+ INCR, 50/5 min/max/avg/p95: 0/ 3 / 0.53 / 1.00 529ms total, 94517.96 ops/sec
682
+ INCR, batch 50/5 min/max/avg/p95: 0/ 1/ 0.17 / 1.00 339ms total, 294985.25 ops/sec
683
+ LPUSH, 1/5 min/max/avg/p95: 0/ 3 / 0.03/ 0.00 1394ms total, 35868.01 ops/sec
684
+ LPUSH, 50/5 min/max/avg/p95: 0/ 3/ 0.58 / 1.00 584ms total, 85616.44 ops/sec
685
+ LPUSH, batch 50/5 min/max/avg/p95: 0/ 1 / 0.19 / 1.00 383ms total, 261096.61 ops/sec
686
+ LRANGE 10, 1/5 min/max/avg/p95: 0/ 4 / 0.03/ 0.00 1706ms total, 29308.32 ops/sec
687
+ LRANGE 10, 50/5 min/max/avg/p95: 0/ 3 / 0.71 / 1.00 712ms total, 70224.72 ops/sec
688
+ LRANGE 10, batch 50/5 min/max/avg/p95: 0/ 1 / 0.38 / 1.00 772ms total, 129533.68 ops/sec
689
+ LRANGE 100, 1/5 min/max/avg/p95: 0/ 1 / 0.06/ 1.00 3026ms total, 16523.46 ops/sec
690
+ LRANGE 100, 50/5 min/max/avg/p95: 0/ 5/ 1.88 / 3.00 1882ms total, 26567.48 ops/sec
691
+ LRANGE 100, batch 50/5 min/max/avg/p95: 2/ 4/ 2.09 / 3.00 4189ms total, 23872.05 ops/sec
692
+ SET 4MiB buf, 1/5 min/max/avg/p95: 1/ 7 / 2.08 / 3.00 1044ms total, 478.93 ops/sec
693
+ SET 4MiB buf, 20 /5 min/max/avg/p95: 17/ 50 / 40.02/ 46 .00 1022ms total, 489.24 ops/sec
694
+ SET 4MiB buf, batch 20 /5 min/max/avg/p95: 37/ 45 / 39.00/ 44.40 975ms total, 512.82 ops/sec
695
+ GET 4MiB str, 1/5 min/max/avg/p95: 4/ 15 / 6.31 / 10.00 634ms total, 157.73 ops/sec
696
+ GET 4MiB str, 20 /5 min/max/avg/p95: 7/ 124/ 88.27/ 110.80 476ms total, 210.08 ops/sec
697
+ GET 4MiB str, batch 20 /5 min/max/avg/p95: 76/ 99/ 89.00/ 99 .00 446ms total, 224.22 ops/sec
698
+ GET 4MiB buf, 1/5 min/max/avg/p95: 4 / 12 / 5.67 / 10.00 568ms total, 176.06 ops/sec
699
+ GET 4MiB buf, 20 /5 min/max/avg/p95: 14/ 133/ 85.34/ 107.95 458ms total, 218.34 ops/sec
700
+ GET 4MiB buf, batch 20 /5 min/max/avg/p95: 78/ 96/ 88.00/ 96 .00 440ms total, 227.27 ops/sec
701
+ End of tests. Total time elapsed: 50421 ms
695
702
696
703
The hiredis and js parser should most of the time be on the same level. The js parser lacks speed for large responses though.
697
704
Therefor the hiredis parser is the default used in node_redis and we recommend using the hiredis parser. To use ` hiredis ` , do:
0 commit comments