Table of contents
1.
Introduction
2.
Redis Time Series
2.1.
Reasons for Using Redis Time Series
2.2.
Use Cases of Redis Time Series
2.3.
Main Capabilities of Redis Time Series
3.
Developing Redis Time Series
3.1.
Cloning the Git repository
3.2.
Working in an Isolated Environment
3.3.
Installing Prerequisites
3.4.
Installing Redis
3.5.
Building and Running Redis
3.6.
Running Test
3.7.
Debugging
4.
Frequently Asked Questions
4.1.
What are the different memory usages of Redis?
4.2.
Can we use Redis on a disk-based Database?
4.3.
Can we Reduce the overall Redis Memory usage?
4.4.
What does the Redis Stand for?
5.
Conclusion
Last Updated: Mar 27, 2024

Development in Time Series

Author Naman Kukreja
0 upvote

Introduction

In today’s world, if someone asks you what the most important thing companies require to succeed, some might say investment or any other item. Still, the answer is data and proper analysis at the appropriate timestamp. If the data is essential to the company, the developer is working in the company or any other freelancer.

So to analyze the data, the data need to be related to the previous data for better comparison. There are many ways to store data in that order, and among all the other time series is one of the most suitable methods. We will learn the reason for the same in this blog. So without wasting any further time, let's get on with our topic.

Redis Time Series

As the name suggests, the redis time series is a sequence of timestamps and values corresponding to different time stamps. In this, we store the importance of data from different periods in a connected way to compare and analyze the data over periods.

In time series, the data is stored in a connected manner like LinkedList, with different nodes representing the different timestamps.

Redis Time Series has many uses like stock prices, IoT, and telemetry. Redis Time Series is advisable over regular time series as with this, and you can query and analyze millions of samples with the speed of redis. It also provides some advanced tooling such as aggregation and downloading. It uses a variety of queries for monitoring and visualization with built-in connectors to popular tools.

Reasons for Using Redis Time Series

Recently, time-series databases have grown in popularity. We believe there are two critical technological causes for this trend the ever-growing volumes of data and new time series use cases for algorithmic trading, online retail, self-driving cars, smart homes, and more.

There are mainly two reasons for using the redis time series:

The first is that most existing databases can handle more read requests than write requests, but in the time-series database, we can handle an extensive volume of data, write requests and read requests. Redis is capable of delivering high write throughput with low latency.

The second reason is the toolset that we require to use time series. We cannot use the regular databases toolsets, and redis provide a toolset for easy use of time series.

Use Cases of Redis Time Series

There are multiple uses of the Redis Time Series. We will discuss some of them in this blog section.

  1. Anomaly detection: We can process millions of transactions or requests within seconds with low latency. SO we can react to enemies in real-time.
  2. Telemetry: We can collect data from any remote devices in the cloud or on edge for analysis and redirection to IoT devices.
  3. Application Monitoring: Gain deep insights into application health and infrastructure with integrations into Telegraf and Grafana.

Main Capabilities of Redis Time Series

In this blog section, we will discuss some of the main capabilities of the Redis Time Series.

  1. Retention and DownSampling: Redis Time Series automatically executes retention and downsampling rules to store the extensive data of telemetry applications using double delta compression in a space-efficient manner.
  2. Fast data ingest with infinite scale: Supports millions of operations with low latency. It can achieve linear horizontal scalability. It allows fast operations no matter the number of data points in time series because of cluster architecture.
  3. Visualization with Grafana: It is integrated with popular analytics, data collection, and monitoring libraries, including grafana for analytics and telegraf for data, ingest.

Developing Redis Time Series

In this blog, the section will learn all the steps for developing the redis time series. Various steps involved in developing the redis time series are developing the environment, running tests and benchmarks, building Redis Time Series,  and debugging.

Cloning the Git repository

Please run the following command to clone Redis Time Series and its submodules.

git clone --recursive https://github.com/RedisTimeSeries/RedisTimeSeries.git

Working in an Isolated Environment

We can work in any environment, but working in an isolated environment has advantages like a clean workstation, a different Linux distribution, etc. The most common option available for an isolated environment is Virtual Machine. You can also use Docker due to its availability to provide an instant solution:

ts=$(docker run -d -it -v $PWD:/build debian:bullseye bash)
docker exec -it $ts bash

Now, all the installations are within the Docker Container. After exiting the container, you can either revoke the container or commit the stage of the container:

docker commit $ts ts1
docker stop $ts
ts=$(docker run -d -it -v $PWD:/build ts1 bash)
docker exec -it $ts bash

Installing Prerequisites

To run and test Redis Time Series, you must install several packages. Run the following command to install packages:

cd RedisTimeSeries
git submodule update --init --recursive    
./deps/readies/bin/getpy3
./system-setup.py

The last line will install several packages. If you want to avoid it, you can follow the following suggestions:

  • Use an isolated environment
  • and Utilize a python virtual environment.

Installing Redis

Make sure that you are working with the latest version of redis. You can either install it by OS package manager if it is available in your OS or just run the following command in either case:

./deps/readies/bin/getredis

Building and Running Redis

Make command will build redis time series. The build artifacts are placed into bin/linux-x64-release. Use make clean requests to clean the build artifacts.

The make run command will build run, and load the redis.

Running Test

The running module includes basic sets of integration tests and unit tests:

  • Python integration tests run by make flow_tests.
  • C unit tests run by make unit_tests.

One can run all the tests by invoking make test.

Debugging

To build for debugging, make DEBUG=1. In general, one can use the macro to set a breakpoint in Redis Time Series. Python tests in single-test mode using different functions inside a test. You can combine the two methods as one can set the breakpoint and other processes to debug the module.

Check out most important Git Interview Questions here.

Also read anomalies in database

Frequently Asked Questions

What are the different memory usages of Redis?

The empty instances use 3MB of memory, whereas 1Million small Keys use 85MB of memory.

Can we use Redis on a disk-based Database?

Yes, we can use Redis on a disk-based Database.

Can we Reduce the overall Redis Memory usage?

Yes, you can reduce the overall memory usage of reis by using 32-bit instances of redis.

What does the Redis Stand for?

Redis is an acronym for Remote Dictionary Server.

Conclusion

In this article, we have extensively discussed Development in Redis Time Series with step by step explanation. We have also discussed the benefits and use cases of Redis Time Series, followed by Its capabilities that make it different from other databases.

We hope this blog has helped you enhance your knowledge of development in the Redis Time series. If you want to know more about redis and its data types, you must refer to this blog. You will get a complete idea about all the data types associated with redis with a suitable explanation.

Refer to our guided paths on Coding Ninjas Studio to learn more about DSA, Competitive Programming, React, JavaScript, System Design, etc. Enroll in our courses, refer to the mock test and problems; look at the interview experiences and interview bundle for placement preparations. Do upvote our blog to help other ninjas grow.

 “Happy Coding!”

Live masterclass