/ts-counter

Demo of usage of Redis Triggers/Functions to implement time series aggregations.

Primary LanguageJavaScriptOtherNOASSERTION

Time-slot Counter Demo

Contents

  1. Summary
  2. Architecture
  3. Approach
  4. Features
  5. Prerequisites
  6. Installation
  7. Usage

Summary

This is a Javascript-based demo of the Redis Gears 2.0 Functions. A Redis Function is deployed that provides time slot counters at the 1 sec, 1 min, 5 min, 30 min and 1 day level for any given key. A REST API server implemented in Express JS provides client access to the function for increments and fetches of counters. Finally, a Javascript function is provided to simulate and time execution of random read/write operations on the counters.

Architecture

architecture

Approach

A Redis Function library (server-side) provides the bulk of the functionality of this demonstration. That library provides 2 functions: increment and fetch. The increment function will update the associated timeslot counters (1 sec, 1 min, 5 min, 30 min, 1 day) for any given key. The fetch function will retrieve those counters for a key and a given time slot.

Features

  • Redis 2.0 Gears Functions, ExpressJS-based REST API server, simulator.

Prerequisites

  • Docker
  • Docker Compose

Installation

git clone https://github.com/joeywhelan/ts-counter.git && cd ts-counter

Usage

Demo start-up

./start.sh

Demo shutdown

./stop.sh

Sample Results

rladmin status

rladmin

RedisInsight

insight

Simulator

100 iterations of random read/write operations at random time intervals (1 ms - 1 sec)
Ave Write Latency: 2.12 ms
Ave Read Latency:  1.82 ms