Jedis Pipeline - Understanding the working of Pipeline in GET operation

114 views
Skip to first unread message

Abhishek Patel

unread,
Jun 22, 2015, 1:30:59 PM6/22/15
to jedis...@googlegroups.com
Hi,

I just started using the Pipeline feature. Previously I evaluated performance of Pipeline for SET operation and it was quite amazing. So I decide to evaluate the performance of Pipeline in GET operation. To do this effectively, I want to understand the working of the Pipeline in GET operation. My code looks like this-




         List<Response<String>> lstofresponse = new ArrayList<Response<String>>();

         long loopstime = System.currentTimeMillis();
         for ( int k = 0; k < n; k++)
         {
            Response<String> r = pipeline.get(k+instanceid);
            lstofresponse.add(r);

         }
         long loopetime = System.currentTimeMillis();

         pipeline.sync();
         long execetime = System.currentTimeMillis();
        
         long valloopstime = System.currentTimeMillis();
         for(Response<String> r : lstofresponse)
         {
             String val = r.get();
         }
         long valloopetime = System.currentTimeMillis();
        
        
         System.out.println("Loop Time = " + (loopetime - loopstime));
         System.out.println("Execution Time = " + (execetime - loopetime));
         System.out.println("Val loop time = " + (valloopetime - valloopstime));

Output-

Loop Time = 21091
Execution Time = 3431
Val loop time = 10040
Get 10000000 in Time : 34563



Now, my question is, when I get the actual values for my keys from Redis, when statement ' pipeline.sync(); ' is executed or when I actually iterate over the List of Response and I write response.get() (as done in the second loop) ?

Thanks in advance

Abhishek Patel 

Marcos Lilljedahl

unread,
Jun 22, 2015, 1:39:32 PM6/22/15
to jedis...@googlegroups.com
Hi Abhishek, 

The values are retrieved when the sync method is called. 

Cheers, 

Marcos.

--
You received this message because you are subscribed to the Google Groups "Jedis" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jedis_redis...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages