Skip to content

Commit

Permalink
GRAD2-3166 - Slowness in retrieving data from Redis cache
Browse files Browse the repository at this point in the history
  • Loading branch information
kamal-mohammed committed Dec 9, 2024
1 parent 9dca2ba commit b261637
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/create-redis-cluster-DEV.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env:
COMMON_NAMESPACE: ${{ vars.COMMON_NAMESPACE }}
GRAD_NAMESPACE: ${{ vars.GRAD_NAMESPACE }}
BUSINESS_NAMESPACE: ${{ vars.GRAD_BUSINESS_NAMESPACE }}
REPLICAS: 6
REPLICAS: 9
on:
workflow_dispatch:
jobs:
Expand Down Expand Up @@ -42,5 +42,5 @@ jobs:
echo "Retrieve redis password..."
REDIS_PASSWORD=$(oc -o json get secret redis-ha | sed -n 's|.*"REDIS_PASSWORD": "\([^"]*\)".*|\1|p' | base64 --decode)
echo "Creating Cluster..."
oc exec -i redis-ha-0 -- redis-cli --cluster create --cluster-replicas 1 $(oc get pods -l app=redis-ha -o jsonpath='{range.items[*]}{.status.podIP}:6379 {end}') --cluster-yes -a $REDIS_PASSWORD
oc exec -i redis-ha-0 -- redis-cli --cluster create --cluster-replicas 2 $(oc get pods -l app=redis-ha -o jsonpath='{range.items[*]}{.status.podIP}:6379 {end}') --cluster-yes -a $REDIS_PASSWORD
echo "Success!"
4 changes: 2 additions & 2 deletions .github/workflows/create-redis-cluster-PROD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env:
COMMON_NAMESPACE: ${{ vars.COMMON_NAMESPACE }}
GRAD_NAMESPACE: ${{ vars.GRAD_NAMESPACE }}
BUSINESS_NAMESPACE: ${{ vars.GRAD_BUSINESS_NAMESPACE }}
REPLICAS: 6
REPLICAS: 9
on:
workflow_dispatch:
jobs:
Expand Down Expand Up @@ -42,5 +42,5 @@ jobs:
echo "Retrieve redis password..."
REDIS_PASSWORD=$(oc -o json get secret redis-ha | sed -n 's|.*"REDIS_PASSWORD": "\([^"]*\)".*|\1|p' | base64 --decode)
echo "Creating Cluster..."
oc exec -i redis-ha-0 -- redis-cli --cluster create --cluster-replicas 1 $(oc get pods -l app=redis-ha -o jsonpath='{range.items[*]}{.status.podIP}:6379 {end}') --cluster-yes -a $REDIS_PASSWORD
oc exec -i redis-ha-0 -- redis-cli --cluster create --cluster-replicas 2 $(oc get pods -l app=redis-ha -o jsonpath='{range.items[*]}{.status.podIP}:6379 {end}') --cluster-yes -a $REDIS_PASSWORD
echo "Success!"
4 changes: 2 additions & 2 deletions .github/workflows/create-redis-cluster-TEST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env:
COMMON_NAMESPACE: ${{ vars.COMMON_NAMESPACE }}
GRAD_NAMESPACE: ${{ vars.GRAD_NAMESPACE }}
BUSINESS_NAMESPACE: ${{ vars.GRAD_BUSINESS_NAMESPACE }}
REPLICAS: 6
REPLICAS: 9
on:
workflow_dispatch:
jobs:
Expand Down Expand Up @@ -42,5 +42,5 @@ jobs:
echo "Retrieve redis password..."
REDIS_PASSWORD=$(oc -o json get secret redis-ha | sed -n 's|.*"REDIS_PASSWORD": "\([^"]*\)".*|\1|p' | base64 --decode)
echo "Creating Cluster..."
oc exec -i redis-ha-0 -- redis-cli --cluster create --cluster-replicas 1 $(oc get pods -l app=redis-ha -o jsonpath='{range.items[*]}{.status.podIP}:6379 {end}') --cluster-yes -a $REDIS_PASSWORD
oc exec -i redis-ha-0 -- redis-cli --cluster create --cluster-replicas 2 $(oc get pods -l app=redis-ha -o jsonpath='{range.items[*]}{.status.podIP}:6379 {end}') --cluster-yes -a $REDIS_PASSWORD
echo "Success!"
4 changes: 2 additions & 2 deletions redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ oc delete -n <namespace-env> all,rc,svc,dc,route,pvc,secret,configmap,sa,RoleBin
```
###### Deploy Redis
```
oc process -f redis/redis-ha.dc.yaml -p REPLICAS=6 | oc apply -f -
oc process -f redis/redis-ha.dc.yaml -p REPLICAS=9 | oc apply -f -
```

###### Create Redis Cluster
- Once all the pods are running, run the following command to initialize the cluster:

```
oc exec -it redis-ha-0 -- redis-cli --cluster create --cluster-replicas 1 $(oc get pods -l app=redis-ha -o jsonpath='{range.items[*]}{.status.podIP}:6379 {end}') --cluster-yes -a <password>
oc exec -it redis-ha-0 -- redis-cli --cluster create --cluster-replicas 2 $(oc get pods -l app=redis-ha -o jsonpath='{range.items[*]}{.status.podIP}:6379 {end}') --cluster-yes -a <password>
```
10 changes: 5 additions & 5 deletions redis/redis-ha.dc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ objects:
name: redis-ha
resources:
requests:
cpu: "10m"
memory: "50Mi"
limits:
cpu: "50m"
memory: "250Mi"
memory: "256Mi"
limits:
cpu: "200m"
memory: "512Mi"
volumes:
- name: conf
configMap:
Expand All @@ -161,7 +161,7 @@ objects:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
storage: "100Mi"
parameters:
- name: REPLICAS
description: Number of Replicas for the Redis cluster
Expand Down

0 comments on commit b261637

Please sign in to comment.