I made a funny observation on a Redis instance deployed to my AWS EC2 Micro instance (test environment)
I measured the execution time of various operations that Redis should have hit. So, the runtime (average) is shown below:
Jedis -> Redis Connection is 63 milliseconds Read of top Element in a list using lrange(<listname>,0,1) is 44 milliseconds Read of entire Elements of set is 5ms Iteration over entire Set space is 60ms( Set space approx 130 elements) Iteration over subset of elements of set is 5ms ( Subset element size is 5)
Now the first 2 operations (connecting and extracting the top item in the list) bother me.
To connect, the code is shown below:
Jedis redis= new Jedis("localhost");
And to retrieve the top item in the list:
String currentDate = redis.lrange(holderDate,0,1).get(0);
Now from the Redis lrange Command:
Time complexity: O (S + N), where S is the initial offset, and N is the number of elements in the specified range.
Now from my code S will be 0 and N will be 1.
Then my question is: what causes these runtimes for these somewhat trivial operations.
Are there any EC2 Micro instance features that could adversely affect the performance of these operations.
Some key information about deploying Redis:
redis_version:2.4.10 used_memory:2869280 used_memory_human:2.74M used_memory_rss:4231168 used_memory_peak:2869480 used_memory_peak_human:2.74M mem_fragmentation_ratio:1.47
Thanks in advance.