Set speed test of predis

Source: Internet
Author: User
: This article mainly introduces the set speed test of predis. if you are interested in the PHP Tutorial, refer to it. Set speed test of 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 command of predis takes about 100000 seconds.

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 command of predis takes about 48 s for 1000000 times.

Php is not easy to test for 10000000 sets. I used a browser for access. after a long time, I couldn't return the results, and I couldn't find a solution. if anyone solved the problem, I 'd like to ask!

Test code:


  require'/home/xubo/cloud/redis/clients/predis/autoload.php';$redis = new Predis\Client([      'scheme'=>'tcp',      'host' => '127.0.0.1',      'port' => 6379,      'password' =>'foobared',]);//$client = new Predis\Client();$client = new Predis\Client([      'scheme'=>'tcp',      'host' => '127.0.0.1',      'port' => 6379,      'password' =>'foobared',]);$fn=100000;//$client = new Predis\Client();$client = new Predis\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/10)==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 Disclaimer: This article is an original article by the blogger. You are welcome to repost and exchange it!

The above describes the set speed test of predis, including the content, and hope to be helpful to friends who are interested in PHP tutorials.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.