/r/redis

Photograph via snooOG

All about the Redis key-value store

Redis is a persistent data structure server operating on the key/value model, where values can be hashes, lists, sets, or sorted sets.

Resources:

/r/redis

7,403 Subscribers

0

New Redis community @ r/redfly_ai

I have started a new community which will contain stories about Redis from discussions with our Technical Advisory Board and thoughts and comments on Redis.

All are welcome!

r/redfly_ai

2 Comments
2024/05/18
17:35 UTC

0

Redis For Windows 11 Git

Hello everyone, I want to install Redis on Windows 11. I have watched some videos on YouTube about installing Redis, but I found one method quite different.

There is a .exe file of Redis for Windows 11 on GitHub, which can be installed to run Redis on Windows 11. Another method is to install Redis through Linux or Docker.

Is the Redis GitHub option the right one? Because its setup is very easy.

I want to install Redis for the purpose of learning and using BullMQ. Will the Redis GitHub version provide me with all the necessary features that a backend developer should know?

Redis for Windows 11 GitHub link. https://github.com/tporadowski/redis/releases

3 Comments
2024/05/16
16:28 UTC

2

Common pain-points in Redis currently?

Howdy all, I'm working with a small team of engineers looking to contribute to open source tools for Redis for a project. What are some of your most common pain-points, issues, complaints with Redis as it stands today? Are there any problems an open source project could solve for it's developers even if they're smaller issues?

5 Comments
2024/05/15
02:37 UTC

5

Best caching solution with low latency to replace Redis? Currently exploring Garnet

Helloo any suggestions or thoughts are appreciated! Looking for a modern solution that supports dynamic changes containerization scaling up scaling down with Persistent volume groups. That is also Easily Scalable high performance ,high elasticity and can be deployed on premise .

8 Comments
2024/05/13
12:21 UTC

0

How to fix the "connection pool timeout" error in Go Redis ?

My project involved microservices architecture, each written in Golang. All of those microservices creates individual clients (in the beginning) of a common Redis hosted on a separate node in K8s. We use go-redis library for this purpose. Now, while creating the Redis client, we don't specify any option except the host:port address and the pool size for each client in microservice is 10 (which is the default one).

Here's the code for that:

cli := redis.NewClient(&redis.Options{
        Addr:     config.Url,
        Password: "",
        DB:       0,
})
if _, err := cli.Ping(ctx).Result(); err != nil {
        return nil, err
}

Few months ago, we encountered a high traffic in our system i.e. around roughly 20 lakhs requests on Redis server in 1 hour. Out of that: 6.2 lakhs requests were of cache miss, 50k requests were of cache invalidate, 1.8 lakhs requests were of cache set, 12 lakhs requests were of cache get and others. Now, here's what happened: Frontend called POST API A1 of our gateway microservice M1. A1 API called POST API A2 of microservice M2 and A2 called a GET API A3 of microservice M3. This API A3 was called approx 2 lakhs times in 1 hour. This API A3 simply fetches data from Redis. Since our entire system is dependent on Redis, we started getting this error on Redis GET Command - "redis: connection pool timeout". Here's the code of GET cache:

val, err := cli.Slave.Get(*ctx, request.Key).Bytes()
if err == redis.Nil {
        common.LogCache(ctx, common.LogCacheMiss, "somekey")
        return nil, nil
} else if err != nil {
        return nil, err
}
return val, nil

I haven't been able to find the reason for why it happened. I checked the Redis info of my server and got to know that we have max clients limit of 10000. Also, the average connected clients at a particular instance of time in Redis is 300-400. We have around 2.5 million keys and are using around 8.6 GB memory out of total 12 GB. In this duration, over 2 lakhs cache requests gave a latency of more than 3 seconds.

I also tried Redis benchmarking on this Redis server with the criteria of 1 lakh requests, 10 clients, data size = 1 MB, keys = 2.5 million but it is giving p99 results with max of 3 ms. I was thinking of increasing the pool size but I believe it won't do any good as mentioned in the official documentation of go-redis.

I am unable to find the cause why I got this error and how should I fix it in future, if it arises again. Can anyone please help ?

0 Comments
2024/05/12
07:32 UTC

3

Companies that use Redis and pay the most

Hey all,

I was doing some scraping and now have a db of about 8k job openings. Quite a few (~300) were specifically hiring for developers who know Redis.

I created a page that lists the companies that pay the most. If you are curious you can check it out here: https://gettjalerts.com/jobs/redis/highest-paid/

Hope someone finds this useful.

4 Comments
2024/05/09
06:16 UTC

0

Enable redis stream in redis helm chart bitnami with terraform

Hello everyone, I have a problem related to deploying redis stream via helm chart, can someone help me please? This is the stackoverflow link to the isse: https://stackoverflow.com/questions/78443876/enable-redis-stream-in-redis-helm-chart-bitnami-with-terraform/78444060#78444060

Thank you.

0 Comments
2024/05/08
17:31 UTC

0

What are expected values for intrinsic-latency benchmark?

redis-cli --intrinsic-latency 100
Max latency so far: 1 microseconds.
Max latency so far: 5 microseconds.
Max latency so far: 27 microseconds.
Max latency so far: 68 microseconds.
Max latency so far: 412 microseconds.
Max latency so far: 4166 microseconds.
Max latency so far: 23110 microseconds.
Max latency so far: 48199 microseconds.
Max latency so far: 59218 microseconds.
Max latency so far: 81128 microseconds.
Max latency so far: 87153 microseconds.

1400299235 total runs (avg latency: 0.0714 microseconds / 71.41 nanoseconds per run).
Worst run took 1220403x longer than the average latency.

Seems like there is an occasional really big latency (87ms).

However, the average is still low.

Is this expected benchmark profile or is this indicative of an issue?

4 Comments
2024/05/06
17:04 UTC

6

Redis sales cold calling me at 4 am

Has anyone else recently have had very aggressive redis sales people reach out to you and your entire team?

2 Comments
2024/05/05
16:07 UTC

1

TLS certs only with latest openssl

I'm new to redis so bare with me.

I am not using a redis cluster nor an enterprise (so no Cluster CA), so when I generate my own TLS certs I thought everything was working until I started generating certs and CA with openssl on Ubuntu.. 24.04 has a version dating back to Feb 24,and Ubuntu 22.04 dating back to 2022 if I remember right.

Anyway, during testing I've been using arch, which appears to be using the latest openssl and everything has been working perfectly the last few months... However my containers are usually Ubuntu based, so when I generate ssl with those containers, redis appears to be tls ready according to logs, but unable to accept the CA from the client. It doesn't appear to matter which version of redis (docker) I use, it seems to want the latest openssl CA I generate. My openssl generation is reproducible, using a script I wrote.

Am I going mad? It only works with one version of openssl? Mariadb accepts all versions of openssl, as I'm using mariadb alongside.

The redis servers i'm using don't need exposure to the great wide world, and self signed was all I wanted. I can probably get away with using redis without tls, since I've encrypted the data being sent anyway, but thought it was worth a discussion and if I'm right,. Might save someone some time.

My openssl snippet from the script...

# Generate CA key and certificate
openssl genrsa 2048 > "$DB_SSL_DIR/ca-key.pem"
openssl req -new -x509 -nodes -days 365000 \
-key "$DB_SSL_DIR/ca-key.pem" -out "$DB_SSL_DIR/ca-cert.pem" \
-subj "/C=GB/ST=Scotland/L=Edinburgh/O=homelab/CN=www.example.com"

# Create server key and certificate, sign it with the CA
openssl req -newkey rsa:2048 -days 365000 \
-nodes -keyout "$DB_SSL_DIR/server-key.pem" -out "$DB_SSL_DIR/server-req.pem" \
-subj "/C=GB/ST=Scotland/L=Edinburgh/O=homelab/CN=www.example.com"
# removing passphrase for automation
openssl rsa -in "$DB_SSL_DIR/server-key.pem" -out "$DB_SSL_DIR/server-key.pem"
openssl x509 -req -in "$DB_SSL_DIR/server-req.pem" -days 365000 \
-CA "$DB_SSL_DIR/ca-cert.pem" -CAkey "$DB_SSL_DIR/ca-key.pem" -set_serial 01 \
-out "$DB_SSL_DIR/server-cert.pem"

# Create client key and certificate, sign it with the CA
openssl req -newkey rsa:2048 -days 365000 \
-nodes -keyout "$DB_SSL_DIR/client-key.pem" -out "$DB_SSL_DIR/client-req.pem" \
-subj "/C=GB/ST=Scotland/L=Edinburgh/O=homelab/CN=www.example.com"
openssl rsa -in "$DB_SSL_DIR/client-key.pem" -out "$DB_SSL_DIR/client-key.pem"
openssl x509 -req -in "$DB_SSL_DIR/client-req.pem" -days 365000 \
-CA "$DB_SSL_DIR/ca-cert.pem" -CAkey "$DB_SSL_DIR/ca-key.pem" -set_serial 01 \
-out "$DB_SSL_DIR/client-cert.pem"
2 Comments
2024/05/05
07:30 UTC

1

Looking for a cache-invalidation strategy

Here's the problem I'm trying to solve:

  • We cache a few of our API responses on redis (AWS Elasticache)
  • One of APIs whose response is cached gets invoked frequently but is also heavy on our DB & slow (which is why we cache)
  • We are experience DB load issues on TTL expiry for the this API's response within Redis.
  • This happens because
    • the API takes 10+ seconds to formulate a response for a single user.
    • But, since this API is frequent-used, a large number of requests hit our DB for this API (before its response gets cached).
    • As a result, the regular 10+ seconds to prepare the response reaches 2-3 minutes.
    • The high DB load for this 2-3 minutes causes our system to be unstable during this time.

With the above problem, my Q is:

Currently, a large number of requests reach our DB between TTL expiry and filling-up of Redis cache with the fresh response. Is there a cache-invalidation approach I can implement where I can ensure only a single request reaches our DB instead and populates the cache?

​

6 Comments
2024/05/03
13:28 UTC

1

Help wanted. HA redis on active-active openshit cluster

Hi guys. I'm more programmer than devops engineer, but I'm trying to create deployment of /simple/ redis cluster to our env. as proof of concept. We have two datacenters with active-active configuration and third small datacenter as quorum locality. Is it possible to simply deploy redis to configuration like in the image by some existing helm chart? I've done some small research on the internet, but when someone is using 3 localities, they have redis instance on third locality as well, but I need to have only sentinel instance on our quorum locality.

​

https://preview.redd.it/kn5fq47y2txc1.png?width=861&format=png&auto=webp&s=9c8ff2f9a96b77153d5cda356d989c8c9116a39c

1 Comment
2024/05/01
12:09 UTC

1

Suggest some resources for caching APIs with dynamic data using Redis

I was developing some APIs with dynamic type of data response, I wanted to cache those responses using redis, i am fairly new to the caching world so any resources on caching the data responses would be extremely helpful.

Thank you.

2 Comments
2024/04/29
07:05 UTC

1

Problems getting to redislabs.com through redis.io??

Has anyone else been having problems logging into app.redislabs.com? I'm a newbie to them, and am still not sure how they are related to redis.io but I havent been able to login to either one of them for the past few days.

Any help is appreciated.

2 Comments
2024/04/28
16:51 UTC

0

About RedisAI

Can RedisAI be used to speed up indexing or performance optimization of database queries?

2 Comments
2024/04/27
15:26 UTC

0 Comments
2024/04/26
16:11 UTC

1

Is redis certification worth it???

Is there any company actively hiring for this certificate? My resume looks empty so will this add any value to it? I really want to dive into redis and try my best to contribute to redis.

4 Comments
2024/04/21
17:03 UTC

0

Redis hastable - Go implementation

Hi,

In the project of creating an in-memory database written in go, I've tried to implement the redis hashtable using go -> https://github.com/dmarro89/go-redis-hashtable
Please, feel free to leave any kind of feedback or comment here or on the github discussion section.

Thanks

0 Comments
2024/04/20
14:26 UTC

2

Redis or Mongo for 2 field sorting with pagination

I have JSON data and want to implement pagination. You can think about any webshop with products loaded into pages.

I have to do 2 level sorting (never more, only 2) and apply filters. Here's an example query:
FT.AGGREGATE h:s * LOAD 3 $.id $.price $.type SORTBY 4 type ASC id DESC LIMIT 0 10

Based on you experience would you do this in Redis or Mongo if the only goal is to make it as fast as possible? I know you'd need a lot more info, I just need a guess.

6 Comments
2024/04/19
08:19 UTC

4

Redis Cluster on 6 different hosts

I am trying to set up a Redis cluster on 6 different hosts and each Redis instance is running on a docker container. Everything network-wise seems to be ok since I can access from a machine every Redis instance on the other machines, but when I try to create the cluster it gets stuck on the agreement. Does someone know what it can be? Below is the shell:

$ docker exec -it redis-stack redis-cli --cluster create 172.30.10.117:6379 172.30.10.116:6379 172.30.10.118:6379 172.30.10.105:6379 172.30.10.119:6379 172.30.10.120:6379 --cluster-replicas 1

Performing hash slots allocation on 6 nodes...

Master[0] -> Slots 0 - 5460

Master[1] -> Slots 5461 - 10922

Master[2] -> Slots 10923 - 16383

Adding replica 172.30.10.119:6379 to 172.30.10.117:6379

Adding replica 172.30.10.120:6379 to 172.30.10.116:6379

Adding replica 172.30.10.105:6379 to 172.30.10.118:6379

M: bc6cfb58f01d48667ee70eeeb7ddacd3f37cf42a 172.30.10.117:6379 slots:[0-5460] (5461 slots) master

M: 7dde1c74aae8ac65a8e66d8f2b702617711ba565 172.30.10.116:6379 slots:[2731-10922] (5462 slots) master

M: 3ac9293e3f17e75647ace83a7ca58187667d3c5a 172.30.10.118:6379 slots:[5461-8191],[10923-16383] (5461 slots) master

S: 95371f03a49d6869593fbc14495e8271110cd1a4 172.30.10.105:6379 replicates 3ac9293e3f17e75647ace83a7ca58187667d3c5a

S: e738ad8aab93e95e33c34cc9238a051ebea5d17e 172.30.10.119:6379 replicates bc6cfb58f01d48667ee70eeeb7ddacd3f37cf42a

S: b6ba75c0d85c5674847143e444dc229a86812db6 172.30.10.120:6379 replicates 7dde1c74aae8ac65a8e66d8f2b702617711ba565

Can I set the above configuration? (type 'yes' to accept): yes

Nodes configuration updated Assign a different config epoch to each node Sending CLUSTER MEET messages to join the cluster Waiting for the cluster to join ..............................................................................................................................................................................................................................................................................................................................

5 Comments
2024/04/18
08:29 UTC

0

Upstash Redis with Fly.io - Node - `Error: getaddrinfo ENOTFOUND`

Hi! Trying to implement Upstash Redis with Fly, but seeing this error on startup in the logs:

Redis error: Error: getaddrinfo ENOTFOUND fly-withered-wildflower-4438.upstash.io {     "errno": -3007,     "code": "ENOTFOUND",     "syscall": "getaddrinfo",     "hostname": "fly-withered-wildflower-4438.upstash.io" } 

Steps taken:

  • I created my Redis database following the Fly docs
  • Copied the example code block from the Upstash console, replacing the ***

with the my password from the console.

  • Checked everything is working fine locally running a server via redis-cli

locally

  • Deployed via Fly and a Dockerfile. My Fly app and Upstash Redis instance are located in the same region (CDG)
  • Also tried adding { family: 6 }

as a param to the Redis constructor (as others have had success with), which did not fix the issue.

Code - Node/Express

import { Redis } from "ioredis";  

const connectionString =   
    process.env.ENVIRONMENT === "development" 
        ? "redis://127.0.0.1:6379" 
        : process.env.REDIS_CONNECTION_STRING || "";  

const redis = new Redis(connectionString); 

Any ideas here my friends? 📷

Other useful info / screenshots?

Fly dash

📷image1722×390 32.5 KB

Upstash console

📷image1968×1342 233 KB

Dockerfile

# Use an official Node runtime as the base image
FROM node:20 as builder

# Set working directory
WORKDIR /app

# Install dependencies
COPY package.json package-lock.json ./
RUN npm install

# Copy project files into the Docker image
COPY . .

# Build the project
RUN npm run build

# Use a multi-stage build to keep the image size small
FROM node:20-slim

# Set working directory
WORKDIR /app

RUN mkdir -p ./speechFiles

# Copy built artifacts from the builder stage
COPY --from=builder /app/dist ./dist

# Copy package.json and other necessary files for running the application
COPY package.json package-lock.json ./

# Install production dependencies
RUN npm install --production

# Copy Google Cloud credentials into the container
COPY application_default_credentials.json /app/google-credentials.json

# Set GOOGLE_APPLICATION_CREDENTIALS environment variable
ENV GOOGLE_APPLICATION_CREDENTIALS=/app/google-credentials.json

# Run the app
CMD ["npm", "start"]
3 Comments
2024/04/16
17:09 UTC

2

LMPOP vs multiple LPOP

Hi, I see `LMPOP` listed as `@slow` in documentation. While `LPOP` is listed as `@fast`.

If I have to monitor 3 lists and pop items from them. Is it more efficient to call `lmpop` or to call multiple `lpop` (once for each individual list)?

3 Comments
2024/04/11
14:08 UTC

2

How do I download the new Redis 7.4.2?

When I go to the download page it tells me that I need to create an account (or log in with an account from elsewhere). I created an account and now it says it's a Redis Cloud account, which isn't what I wanted. I have no interest in having someone host things for me.

I thought the changes were license changes, but is it a whole paradigm shift where I have to give my information to download anything new? Is the code even available?

When I go back to the download page it doesn't even tell me what version I'm getting -- it just lists distributions to download for. I selected RHEL 8 and it downloaded 7.4.2. But it's for RHEL 8, and the release notes for 7.4.2 says that it supports RHEL 9. So why can't I download a RHEL 9 version?

And is the source no longer available? I always built from source. GitHub says the latest version is 7.2.4, not the 7.4.2 that redis.io is providing.

I'm so confused about the current state of things. Can anyone enlighten me?

4 Comments
2024/04/10
02:06 UTC

0

can I do self hosted multicloud redis on vps ?

Hey,
I wanted to know if it's possible to buy few vps / vms from multiple cloud providers and use these 5 to 10 server to form a cluster is it possible using redis free version ? or do I need an enterprise plan?
What are the common issues I can face using this approach security wise?
Thanks

13 Comments
2024/04/09
15:36 UTC

1

Can a customer deploy Redis as part of a CRM application under the new licensing?

We provide a web-based application which utilizes Redis as a distributed cache. The application is basically a CRM. Redis as a distributed cache is used by the CRM backend servers to speed up queries and ease the load on the database. Redis itself is not offered as a service. We maintain an instance of the application ourselves.

Q1: Can we continue to use Redis under the new licensing?

We also have sold the application to customers. They have deployed and maintain each part of the application themselves, including the Redis nodes.

Q2: Can our customers continue using Redis under the new licensing?

9 Comments
2024/04/05
17:17 UTC

0

My second redis instance won't create a dump.rdb

If I go into redis-cli -p 6380 and do a bgsave, it won't create the dump.rdb. Over time, the server will throw a MISCONF error saying cannot access dump.rdb (/var/lib/redis2). Permission denied. I have to stop the and start the server again to clear the error and the entire thing repeats all over again.

CONFIG GET dir shows /var/lib/redis2 and CONFIG GET dbfilename shows dump.rdb. The folder is chown redis:redis.

What else can I do or check?

EDIT - if I change the dir to /var/lib/redis and dbfilename to dump2.rdb, it creates dump2.rdb in /var/lib/redis.

ls -al /var/lib/redis2 shows

total 4
drwxr-x---.  2 redis redis    6 Apr  3 08:42 .
drwxr-xr-x. 35 root  root  4096 Mar  5 06:49 ..
0 Comments
2024/04/03
08:57 UTC

Back To Top