Tervela Sample App: Redis Key-Value Caching


by Steve Cummings

Contributed by Hari Balimidi

Using Tervela With a Key-Value Store

Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

Other caching technologies with similar integration paths to Tervela's Data fabric include:

This sample application shows how to integrate Tervela with Redis and how they can work together. It provides a good demonstration of Tervela interacting with Redis in a multiple data cache sample (4 are used). The sample application source code is included for someone wanting to modify the application or dig deeper into the way either Tervela Data Fabric or Redis works.

What This App Demonstrates

Tervela's data fabric is the fastest and most reliable way to transport data. When used with a key-value store, the Tervela Message Switch (TMX) makes an easy, consolidated front-end to multiple caches. This avoids the need for the application to determine which cache holds the data it seeks.

Typically a caching infrastructure consists of many different cache nodes. The application stores key-value pairs on each node, and it is the responsibility of the application to determine where to find and store each blob of data. By putting a TMX in front of the key-value infrastructure, the applicaton can look up the data in one place (the data fabric) and the fabric will find the right cache and handle the data transfer back to the application. This makes key-value programming much easier and more reliable. It also greatly simplifies scalability of the system as the application doesn't need to change in any way as more cache servers are deployed.

How This Sample App Works

  1. The backend (proxy) runs on each of the four REDIS datastores.
  2. The frontend (webapp) publishes a query message through the TMX switch to the backend.
  3. Depending on which backends (datastores 1/2/3/4) are active, search for the query will take place and the retrieved records shall be published as a message through the TMX switch.
  4. Query results will be displayed on the frontend.

Screenshot

The user selects “Pentax” and “Red” and submits a query to which will be serviced by the servlet which publishes to TMX using Tervela messaging. The backend proxies subscribe to the query topic and process the received message with lookups up in redis caches and publish the results back to webfront which will be displayed as the output.

Comments RSS

No comments.