Jedis Read and write Redis test

Source: Internet
Author: User
Package redis.clients.jedis.tests;

Import Redis.clients.jedis.Jedis;
		
		public class Jedisdemo {public static void main (string[] args) {String value = null;
		
		
		Jedis Jedis = new Jedis ("localhost", 6379);   Long Starttime=system.currenttimemillis ();  
		Gets the start time System.out.println ("Start write Test");
		for (int i=0;i<1000000;i++) {jedis.set ("foo" +i, "bar" +i); Long Endtime=system.currenttimemillis ();  
		Get End Time System.out.println ("program Run Time:" + (Endtime-starttime) + "MS"); System.out.println ("Write per Millisecond:" +1000000/(endtime-starttime) + "bar.
		"); System.out.println (write per Second: + (1000000/(endtime-starttime)) *1000+ "bar.
		
		");
		/*jedis.lpush ("foo", "Bar1");
		Jedis.lpush ("foo", "Bar2");  
		Jedis.lpush ("foo", "Bar3"); * * SYSTEM.OUT.PRINTLN ("Start reading Test");   Starttime=system.currenttimemillis ();
			Gets the start time for (int i=0;i<1000000;i++) {value = Jedis.get ("foo" +i);
		System.out.println ("Value:" +value); } endtime=system.currenttimemillis (); Get End Time System.out.println ("program Run Time:" +(endtime-starttime) + "MS"); SYSTEM.OUT.PRINTLN ("read per millisecond:" +1000000/(endtime-starttime) + "bar.
		"); System.out.println (read per second: + (1000000/(endtime-starttime)) *1000+ "bar.

		");
		Value = Jedis.get ("foo");
	System.out.println ("Value:" +value);
 }
}


Test results (notebook WIN7 64 bits, Redis is also using WINDOWS64 bit version):


Start Write Test
Program Run time: 73314ms
Write per millisecond: 13.
Write per second: 13,000.
Start reading tests
Program Run time: 96122ms
Read per millisecond: 10.
Read per second: 10,000.
Value:bar0

Related Article

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.