Databases Reference
In-Depth Information
• The product information, used to serve the website.
• The User Navigation Queue, used to feed the Storm Topology.
• The Storm Topology Intermediate Data, used by the Topology to recover from
failures.
• The Storm Topology Results, used to store the desired results.
Product Information
The Redis Server stores the products using the product ID for the key and a JSON object
containing all the product information as the value.
> redis-cli
redis 127.0.0.1:6379> get 15
"{\"title\":\"Kids smartphone cover\",\"category\":\"Covers\",\"price\":30,\"id\":
15}"
User Navigation Queue
The user navigation queue is stored in a Redis list named navigation and organized as
a first-in-first-out (FIFO) queue. The server adds an entry to the left side of the list each
time a user visits a product page, indicating which user viewed which product. The
storm cluster constantly removes elements from the right side of the list to process the
information.
redis 127.0.0.1:6379> llen navigation
(integer) 5
redis 127.0.0.1:6379> lrange navigation 0 4
1) "{\"user\":\"59c34159-0ecb-4ef3-a56b-99150346f8d5\",\"product\":\"1\",\"type\":
\"PRODUCT\"}"
2) "{\"user\":\"59c34159-0ecb-4ef3-a56b-99150346f8d5\",\"product\":\"1\",\"type\":
\"PRODUCT\"}"
3) "{\"user\":\"59c34159-0ecb-4ef3-a56b-99150346f8d5\",\"product\":\"2\",\"type\":
\"PRODUCT\"}"
4) "{\"user\":\"59c34159-0ecb-4ef3-a56b-99150346f8d5\",\"product\":\"3\",\"type\":
\"PRODUCT\"}"
5) "{\"user\":\"59c34159-0ecb-4ef3-a56b-99150346f8d5\",\"product\":\"5\",\"type\":
\"PRODUCT\"}"
Intermediate Data
The cluster needs to store the history of each user separately. In order to do so, it saves
a set in the Redis server with all the products and their categories that were navigated
by each user.
redis 127.0.0.1:6379> smembers history:59c34159-0ecb-4ef3-a56b-99150346f8d5
1) "1:Players"
2) "5:Cameras"
3) "2:Players"
4) "3:Cameras"
 
Search WWH ::




Custom Search