c# - Redis : use Multi process to query the same data, but take a very different query time -


when query data redis, find previous dozens of processes slow. rest fast. query same data, use different time. or suggestions or things read appreciated.

the c# code:

public static void getdata(object arg)         {              using (var redis = redismanager.getclient())             {                  stopwatch sw = new stopwatch();                 sw.start();                 var count = (int)redis.getsetcount("ids:userbase");                 if (count > 0)                 {                     var client = redis.as<userbase>();                     client.getall();                 }                 sw.stop();                 console.writeline("the {0} process time {1} millseconds,count {2}", new object[] { arg, sw.elapsedmilliseconds, count });             }           }          public static void dojob()         {             (int = 0; < 300; i++)             {                 parameterizedthreadstart start = new parameterizedthreadstart(getdata);                 thread thread = new thread(start);                 thread.start(i);             }         } 

result:

the 61 process time 886 millseconds,count 628 63 process time 674 millseconds,count 628 64 process time 688 millseconds,count 628 65 process time 695 millseconds,count 628 67 process time 667 millseconds,count 628 68 process time 642 millseconds,count 628 70 process time 720 millseconds,count 628 71 process time 708 millseconds,count 628 72 process time 553 millseconds,count 628 73 process time 548 millseconds,count 628 74 process time 642 millseconds,count 628 75 process time 595 millseconds,count 628 76 process time 541 millseconds,count 628 77 process time 137 millseconds,count 628 48 process time 2759 millseconds,count 628 45 process time 3273 millseconds,count 628 16 process time 4339 millseconds,count 628 27 process time 4018 millseconds,count 628 17 process time 4245 millseconds,count 628 3 process time 4518 millseconds,count 628 28 process time 4063 millseconds,count 628 29 process time 4110 millseconds,count 628 32 process time 3894 millseconds,count 628 33 process time 3955 millseconds,count 628 36 process time 3960 millseconds,count 628 37 process time 3930 millseconds,count 628 40 process time 3739 millseconds,count 628 41 process time 3725 millseconds,count 628 44 process time 3316 millseconds,count 628 50 process time 1915 millseconds,count 628 78 process time 61 millseconds,count 628 11 process time 4465 millseconds,count 628 10 process time 4472 millseconds,count 628 23 process time 4153 millseconds,count 628 25 process time 4147 millseconds,count 628 6 process time 4530 millseconds,count 628 7 process time 4427 millseconds,count 628 12 process time 4435 millseconds,count 628 13 process time 4374 millseconds,count 628 14 process time 4410 millseconds,count 628 18 process time 4232 millseconds,count 628 19 process time 4228 millseconds,count 628 20 process time 4198 millseconds,count 628 21 process time 4184 millseconds,count 628 22 process time 4225 millseconds,count 628 82 process time 20 millseconds,count 628 80 process time 21 millseconds,count 628 81 process time 22 millseconds,count 628 83 process time 19 millseconds,count 628 2 process time 4575 millseconds,count 628 5 process time 4484 millseconds,count 628 79 process time 474 millseconds,count 628 1 process time 4480 millseconds,count 628 84 process time 16 millseconds,count 628 86 process time 21 millseconds,count 628 85 process time 17 millseconds,count 628 88 process time 16 millseconds,count 628 89 process time 16 millseconds,count 628 90 process time 17 millseconds,count 628 87 process time 24 millseconds,count 628 91 process time 14 millseconds,count 628 92 process time 18 millseconds,count 628 93 process time 39 millseconds,count 628 94 process time 41 millseconds,count 628 95 process time 39 millseconds,count 628 96 process time 35 millseconds,count 628 97 process time 15 millseconds,count 628 98 process time 13 millseconds,count 628 99 process time 21 millseconds,count 628 101 process time 23 millseconds,count 628 102 process time 20 millseconds,count 628 100 process time 27 millseconds,count 628 103 process time 74 millseconds,count 628 105 process time 69 millseconds,count 628 104 process time 71 millseconds,count 628 107 process time 58 millseconds,count 628 108 process time 26 millseconds,count 628 106 process time 87 millseconds,count 628 109 process time 27 millseconds,count 628 111 process time 41 millseconds,count 628 110 process time 40 millseconds,count 628 112 process time 14 millseconds,count 628 113 process time 12 millseconds,count 628 114 process time 38 millseconds,count 628 115 process time 58 millseconds,count 628 116 process time 33 millseconds,count 628 117 process time 33 millseconds,count 628 118 process time 160 millseconds,count 628 120 process time 134 millseconds,count 628 122 process time 134 millseconds,count 628 119 process time 134 millseconds,count 628 121 process time 134 millseconds,count 628 137 process time 33 millseconds,count 628 123 process time 93 millseconds,count 628 134 process time 64 millseconds,count 628 128 process time 118 millseconds,count 628 135 process time 60 millseconds,count 628 126 process time 122 millseconds,count 628 127 process time 106 millseconds,count 628 132 process time 63 millseconds,count 628 129 process time 106 millseconds,count 628 138 process time 74 millseconds,count 628 130 process time 107 millseconds,count 628 136 process time 62 millseconds,count 628 133 process time 63 millseconds,count 628 140 process time 51 millseconds,count 628 139 process time 78 millseconds,count 628 131 process time 63 millseconds,count 628 125 process time 92 millseconds,count 628 124 process time 92 millseconds,count 628 141 process time 30 millseconds,count 628 143 process time 31 millseconds,count 628 144 process time 36 millseconds,count 628 142 process time 26 millseconds,count 628 145 process time 26 millseconds,count 628 146 process time 22 millseconds,count 628 147 process time 19 millseconds,count 628 148 process time 59 millseconds,count 628 149 process time 56 millseconds,count 628 151 process time 43 millseconds,count 628 152 process time 21 millseconds,count 628 150 process time 43 millseconds,count 628 154 process time 48 millseconds,count 628 


Comments