title: why it is so slow with 100,000 records when using pipeline in redis?
body: <p>It is said that <code>pipeline</code> is a better way when many <code>set/get</code> is required in redis, so this is my test code:</p>
  
  <pre><code>public class TestPipeline {
  
      /**
       * @param args
       */
      public static void main(String[] args) {
          // TODO Auto-generated method stub
  
          JedisShardInfo si = new JedisShardInfo("127.0.0.1", 6379);
          List&lt;JedisShardInfo&gt; list = new ArrayList&lt;JedisShardInfo&gt;();
          list.add(si);
          ShardedJedis jedis = new ShardedJedis(list);
          long startTime = System.currentTimeMillis();
          ShardedJedisPipeline pipeline = jedis.pipelined();
          for (int i = 0; i &lt; 100000; i++) {
              Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
              map.put("id", "" + i);
              map.put("name", "lyj" + i);
              pipeline.hmset("m" + i, map);
          }
          pipeline.sync();
          long endTime = System.currentTimeMillis();
          System.out.println(endTime - startTime);
      }
  }
  </code></pre>
  
  <p>When I ran it, there is no response with this program for a while, but when I don't work with <code>pipe</code>, it takes only 20073 ms, so I am confused why it is even better without <code>pipeline</code> and how a wide gap!</p>
  
  <p>Thanks for answer me, a few questions, how do you calculate 6MB data?
  When I send 10K data, pipeline is always faster than normal mode, but with 100k, pipeline would no response.I think 100-1000 operations is a advisable choice as below said.Is there anyting with JIT since I don't understand it?</p>