Set Speed test for Predis
Redis, PHP, set:
Set/Get100000:Start:1442496208.9368Xubo0:0-- Time:0.00039482116699219sxubo10000:10000-- Time:0.49174094200134sxubo20000:20000-- Time:0.89022397994995sxubo30000:30000-- Time:1.2952389717102sxubo40000:40000-- Time:1.6944959163666sxubo50000:50000-- Time:2.0859758853912sxubo60000:60000-- Time:2.4891138076782sxubo70000:70000-- Time:2.8911108970642sxubo80000:80000-- Time:3.2922348976135sxubo90000:90000-- Time:3.6980829238892SEnd:1442496213.0497s100000:4.1128277778625Set/Get100000:Start:1442496231.5078Xubo0:0-- Time:0.00056314468383789sxubo10000:10000-- Time:0.39918899536133sxubo20000:20000-- Time:0.80352401733398sxubo30000:30000-- Time:1.2234301567078sxubo40000:40000-- Time:1.6409831047058sxubo50000:50000-- Time:2.057382106781sxubo60000:60000-- Time:2.4619610309601sxubo70000:70000-- Time:2.9444301128387sxubo80000:80000-- Time:3.3929440975189sxubo90000:90000-- Time:3.8406541347504SEnd:1442496235.7982s100000:4.2903289794922Set/Get100000:Start:1442496276.5454Xubo0:0-- Time:0.00068187713623047sxubo10000:10000-- Time:0.47572684288025sxubo20000:20000-- Time:0.94239592552185sxubo30000:30000-- Time:1.4021549224854sxubo40000:40000-- Time:1.8193259239197sxubo50000:50000-- Time:2.2206959724426sxubo60000:60000-- Time:2.6312279701233sxubo70000:70000-- Time:3.0266840457916sxubo80000:80000-- Time:3.4182560443878sxubo90000:90000-- Time:3.8248949050903SEnd:1442496280.7723s100000:4.226863861084Set/Get100000:Start:1442496289.7032Xubo0:0-- Time:0.00063514709472656sxubo10000:10000-- Time:0.39353799819946sxubo20000:20000-- Time:0.79392194747925sxubo30000:30000-- Time:1.1953980922699sxubo40000:40000-- Time:1.6089961528778sxubo50000:50000-- Time:2.0243270397186sxubo60000:60000-- Time:2.4311549663544sxubo70000:70000-- Time:2.8455491065979sxubo80000:80000-- Time:3.2610011100769sxubo90000:90000-- Time:3.6794910430908SEnd:1442496293.7885s100000:4.0852270126343
After four Tests, the set instruction of Predis 100,000 times is approximately 4.15s
Set/Get1000000:Start:1442496958.0541Xubo0:0-- Time:0.00064611434936523sxubo100000:100000-- Time:4.5391991138458sxubo200000:200000-- Time:9.1131091117859sxubo300000:300000-- Time:15.13695192337sxubo400000:400000-- Time:21.497059106827sxubo500000:500000-- Time:27.332253932953sxubo600000:600000-- Time:32.020254135132sxubo700000:700000-- Time:36.608731985092sxubo800000:800000-- Time:41.137508153915sxubo900000:900000-- Time:45.799643039703SEnd:1442497008.3659s1000000:50.311782121658Set/Get1000000:Start:1442497141.8665Xubo0:0-- Time:0.00071597099304199sxubo100000:100000-- Time:5.2379097938538sxubo200000:200000-- Time:10.768998861313sxubo300000:300000-- Time:16.702248811722sxubo400000:400000-- Time:21.393670797348sxubo500000:500000-- Time:26.071841955185sxubo600000:600000-- Time:30.615657806396sxubo700000:700000-- Time:35.180080890656sxubo800000:800000-- Time:39.755750894547sxubo900000:900000-- Time:44.237802028656SEnd:1442497190.5661s1000000:48.699581861496Set/Get1000000:Start:1442497396.3979Xubo0:0-- Time:0.00040006637573242sxubo100000:100000-- Time:4.4978289604187sxubo200000:200000-- Time:9.2330050468445sxubo300000:300000-- Time:14.044721841812sxubo400000:400000-- Time:18.668016910553sxubo500000:500000-- Time:23.322139024734sxubo600000:600000-- Time:28.039067029953sxubo700000:700000-- Time:32.682448863983sxubo800000:800000-- Time:37.302042007446sxubo900000:900000-- Time:42.112798929214SEnd:1442497444.1373s1000000:47.739441871643
After three Tests, the set instruction of Predis 1 million times is approximately 48s
10 million times set of bad test with PHP, I use a browser access, long time to return the results, also did not find a solution, if there is someone to solve the problem!
Test code:
require'/home/xubo/cloud/redis/clients/predis/autoload.php ';$redis=NewPredis\client ([' scheme '=' TCP ',' Host '=' 127.0.0.1 ',' Port '=6379,' Password '=' foobared ',]);//$client = new Predis\client ();$client=NewPredis\client ([' scheme '=' TCP ',' Host '=' 127.0.0.1 ',' Port '=6379,' Password '=' foobared ',]);$FN=100000;//$client = new Predis\client ();$client=NewPredis\client ([' scheme '=' TCP ',' Host '=' 127.0.0.1 ',' Port '=6379,' Password '=' foobared ',]);$FN=100000;' Port '=6379,' Password '=' foobared ',]);$FN=100000;Echo"
Set/get $FN:
";$starttime=microtime (true);Echo"Start: $starttime
"; for($i=0;$i<$FN;$i++){//$client = new Predis\client ();$client-Set ("Php$i",$i);if($i% ($FN/Ten)==0){Echo"xubo$i:";Echo$client->get ("Php$i");$ntime=microtime (true);Echo"--time:";Echo$ntime-$starttime;Echo"S";Echo'
'; }}$endtime=microtime (true);$totaltime=$endtime-$starttime;Echo"End: $endtime
";Echo"S";Echo"$FN: $totaltime";?>
Copyright NOTICE: This article for Bo Master original article, welcome to reprint and Exchange!
The above describes the Predis set speed test, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.