Tuesday 6 September 2016

 

Redis usage for Application Cache

Objective
To cache user based API/service response that can enable to provide a much faster response time to server from in memory compare to any other data source. Highly scalable data store shared by multiple processes, multiple applications, or multiple servers.
TechStack – Redis version: 3.2 and Java
Scope
  • Cache any API/service response in Redis (in memory)
  • To enable any API/service to get/set cache value from Redis
  • Implement the caching on key value pair
  • Persistent mechanism supported are AOF (Append Only File), Point in Time or Snapshotting (RDB file) AND Only in Cache.
  • Replication can be configured as master/slave where master can be used to write and all slaves can use to read. A master can have multiple slaves. Slaves are able to accept other slave’s connections. If you set up a slave, upon connection it sends a SYNC command and it doesn't matter if it's the first time it has connected or if it's a reconnection.
  • Following data types are supported by Redis data model:
  • Strings (key-value pair)
  • List of strings
  • Sets of strings
  • Sorted sets of strings
  • Hashes - where keys and values are strings

Performance
The value can consist content, etag, created time, modified time and TTL etc.
SET
  1. 122556.53 requests per second To 552028.75 requests per second
  2. 58.50% <= 0 milliseconds
  3. 99.17% <= 1 milliseconds
  4. 99.58% <= 2 milliseconds
  5. 99.85% <= 3 milliseconds
  6. 99.90% <= 6 milliseconds
  7. 100.00% <= 9 milliseconds
  8. 114293.71 requests per second
 
GET
  1. 123601.76 to 707463.75 requests per second
  2. 43.12% <= 0 milliseconds
  3. 96.82% <= 1 milliseconds
  4. 98.62% <= 2 milliseconds
  5. 100.00% <= 3 milliseconds
  6. 81234.77 requests per second