Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHAOS-5571 Redis cache penetration #6814

Merged
merged 5 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
id: linux-redis-cache-penetration
title: Linux Redis cache penetration
---

import Ossupport from './shared/note-supported-os.md'
import FaultPermissions from './shared/fault-permissions.md'
import AuthenticationDetails from './shared/redis-auth.md'

Linux Redis cache penetration continuously sends cache requests to the Redis database to find the value for a non-existing key. This continuous request reduces the performance of the application.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Linux Redis cache penetration continuously sends cache requests to the Redis database to find the value for a non-existing key. This continuous request reduces the performance of the application.
Linux Redis cache penetration continuously sends cache requests to the Redis database to get the value for a non-existing key. This impacts the performance of the redis server.


![Linux Redis cache penetration](./static/images/linux-redis-cache-penetration.png)

## Use cases
- Slows down the database for responses to other requests.
- Determines the resilience of Redis-dependant application when cache requests are continuously sent to a Redis database and they result in a cache miss.

<Ossupport />

<FaultPermissions />

<AuthenticationDetails />

### External packages
This fault uses [`stress-ng`](https://github.com/ColinIanKing/stress-ng), which is installed as part of the infrastructure installation.

### Optional tunables

<table>
<tr>
<th> Tunable </th>
<th> Description </th>
<th> Notes </th>
</tr>
<tr>
<td> requestCount </td>
<td> Number of times to try to penetrate the Redis cache. </td>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<td> Number of times to try to penetrate the Redis cache. </td>
<td> Number of requests to be sent for accessing the cache. </td>

<td> Default: 1000. For more information, go to <a href="#number-of-requests"> request count. </a></td>
</tr>
<tr>
<td> duration </td>
<td> Duration through which chaos is injected into the target resource. Should be provided in <code>[numeric-hours]h[numeric-minutes]m[numeric-seconds]s</code> format. </td>
<td> Default: <code>30s</code>. Examples: <code>1m25s</code>, <code>1h3m2s</code>, <code>1h3s</code>. For more information, go to <a href="/docs/chaos-engineering/chaos-faults/common-tunables-for-all-faults#duration-of-the-chaos">duration.</a></td>
</tr>
<tr>
<td> rampTime </td>
<td> Period to wait before and after injecting chaos. Should be provided in <code>[numeric-hours]h[numeric-minutes]m[numeric-seconds]s</code> format. </td>
<td> Default: <code>0s</code>. Examples: <code>1m25s</code>, <code>1h3m2s</code>, <code>1h3s</code>. For more information, go to <a href="/docs/chaos-engineering/chaos-faults/common-tunables-for-all-faults#ramp-time">ramp time</a>. </td>
</tr>
</table>

### Number of requests

The `requestCount` input variable indicates the number of times to penetrate the Redis cache. Its default value is 1000.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `requestCount` input variable indicates the number of times to penetrate the Redis cache. Its default value is 1000.
The `requestCount` input variable indicates the number of requests to be sent for accessing the cache. Its default value is 1000.


The following YAML snippet illustrates the use of this input variable:

[embedmd]:# (./static/manifests/linux-redis-cache-penetration/requests.yaml yaml)
```yaml
apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: redis-cache-penetration
labels:
name: cache-penetration
spec:
redisChaos/inputs:
duration: 30s
requestCount: 1000
rampTime: ""
```
19 changes: 19 additions & 0 deletions docs/chaos-engineering/chaos-faults/linux/shared/redis-auth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Redis authentication
The following authentication and connection details reside on the same machine where the chaos infrastructure is executed. These details are provided in the `/etc/linux-chaos-infrastructure/redis.env` file in the following format:

```
ADDRESS="/path/to/redis/server"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ADDRESS="/path/to/redis/server"
ADDRESS="127.0.0.1:6379"

PASSWORD="password"
TLS_AUTH_CERT="/path/tp/tls-cert"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
TLS_AUTH_CERT="/path/tp/tls-cert"
TLS_AUTH_CERT="/path/to/tls-cert"

```

:::tip
`PASSWORD` and `TLS_AUTH_CERT` are optional, whereas `ADDRESS` is a mandatory field. You need them only if you have configured your Redis database to facilitate it.
:::


| **ENV name** | **Description** | **Example** |
|---------------|----------------------------------------------------------------|----------------------------|
| ADDRESS | Location where the Redis server is running. | `https://redis-server.com` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the FQDN is needed.

Suggested change
| ADDRESS | Location where the Redis server is running. | `https://redis-server.com` |
| ADDRESS | Location where the Redis server is running. | `redis-server.com` |

| PASSWORD | Password to connect to the Redis database. | `password` |
| TLS_AUTH_CERT | File path to the location where the TLS certificate is stored. | `/path/to/file` |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: redis-cache-penetration
labels:
name: cache-penetration
spec:
redisChaos/inputs:
duration: 30s
requestCount: 1000
rampTime: ""