Skip to content

Commit

Permalink
feat: add memfill attacks
Browse files Browse the repository at this point in the history
This reverts commit 53f6f3f.
  • Loading branch information
joshiste committed Aug 26, 2024
1 parent 7a1a114 commit 0a2002d
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: com.steadybit.extension_container.fill_disk
label: Fill Disk
description: Fill available disk space
description: Writes data to the disk.
icon: |
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_2810_382)">
Expand Down
10 changes: 10 additions & 0 deletions actions/com.steadybit.extension_container.fill_mem/description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
id: com.steadybit.extension_container.fill_mem
label: Fill Memory
description: Allocates and and holds memory.
icon: |
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M17.106 1.498a.85.85 0 00-.602.25l-.002.003-5.959 5.954.018.084a2.354 2.354 0 01-2.77 2.776h-.007l-.08-.018-5.954 5.955-.001.002a.85.85 0 000 1.205l.001.002 4.54 4.54a.849.849 0 001.206 0l.001-.001L22.25 7.498l.001-.002a.85.85 0 000-1.205l-.002-.002-4.538-4.539-.002-.001a.85.85 0 00-.603-.25zm-.902-1.32a2.35 2.35 0 012.568.512v.001l4.537 4.536a2.348 2.348 0 010 3.332L8.559 23.31a2.348 2.348 0 01-3.331 0h-.001L.691 18.773v-.001a2.35 2.35 0 010-3.332l6.24-6.24a.75.75 0 01.684-.204l.473.1A.855.855 0 009.09 8.088l-.1-.474a.75.75 0 01.205-.685L15.44.691h.001a2.35 2.35 0 01.763-.513z" fill="currentColor"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7.497 15.442a.75.75 0 011.06 0l1.136 1.133a.75.75 0 010 1.061l-2.269 2.27a.75.75 0 01-1.06 0l-1.136-1.135a.75.75 0 111.061-1.06l.605.604 1.208-1.209-.604-.603a.75.75 0 010-1.061zM17.71 5.229a.75.75 0 011.061 0l1.135 1.135a.75.75 0 010 1.06l-2.27 2.27a.75.75 0 01-1.06 0L15.44 8.557a.75.75 0 011.061-1.06l.604.604 1.209-1.208-.605-.605a.75.75 0 010-1.06zm-4.539 4.539a.75.75 0 011.061 0l1.135 1.135a.75.75 0 010 1.06l-3.404 3.404a.75.75 0 01-1.06 0l-1.135-1.135a.75.75 0 111.06-1.06l.605.604 2.343-2.343-.604-.605a.75.75 0 010-1.06zM1.825 14.306a.75.75 0 011.06 0l1.134 1.136a.75.75 0 01-1.06 1.06l-1.135-1.135a.75.75 0 010-1.06zm2.268-2.269a.75.75 0 011.061 0l1.135 1.135a.75.75 0 11-1.06 1.06l-1.136-1.135a.75.75 0 010-1.06zm7.943-7.943a.75.75 0 011.061 0l1.135 1.135a.75.75 0 11-1.06 1.06l-1.136-1.135a.75.75 0 010-1.06zm2.27-2.269a.75.75 0 011.06 0l1.136 1.133a.75.75 0 01-1.06 1.062l-1.135-1.134a.75.75 0 010-1.061z" fill="currentColor"/></svg>
kind: attack
category: resource
targetType: com.steadybit.extension_container.container
extension: com.steadybit.extension_container
29 changes: 29 additions & 0 deletions actions/com.steadybit.extension_container.fill_mem/summary.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Introduction

Allocates a specific amount of memory.

# Usage

Note that this can cause systems to trip the Linux Kernel OOM killer without enough physical or swap Memory.
The operating system may swap out the allocated memory. This attack doesn't take swap memory into account.

In contrast to the [Stress Memory](/action/com.steadybit.extension_container.stress_mem) action, this actions tries to reduce the CPU usage as much as possible.

When using the attack to meet a specific memory usage, it may allocate or free memory to reach the desired memory usage.

> If you specify a usage that exceeds the total memory (e.g. > 100%) it fills up the memory as much as possible until the process is oomkilled, as it's impossible to reach usages higher than 100%.
# Use Cases

* Test the system's ability to handle memory spikes.
* Observe the system's behavior when it runs out of memory.
* Observe the system's behavior when it runs low on memory for file buffers.

# Parameters

| Parameter | Description | Default |
|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|
| Duration | How long should memory be wasted? | 30s |
| Mode | **Fill and meet specified usage:** Fill up the memory until the desired usage is met. Memory allocation will be adjusted constantly to meet the target.<br/> **Fill the specified amount**: Allocate and hold the specified amount of Memory. | Fill and meet specified usage |
| Size | **Percentage of total memory** or **Megabytes**: | % of total memory |
| Fail on OOM Kill | Should it be treated as a failure when the attacked container was oomkilled? | False |
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: com.steadybit.extension_container.stress_mem
label: Stress Memory
description: Allocates memory.
description: Stresses memory by ongoing reallocation, read and write operations.
icon: |
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M17.106 1.498a.85.85 0 00-.602.25l-.002.003-5.959 5.954.018.084a2.354 2.354 0 01-2.77 2.776h-.007l-.08-.018-5.954 5.955-.001.002a.85.85 0 000 1.205l.001.002 4.54 4.54a.849.849 0 001.206 0l.001-.001L22.25 7.498l.001-.002a.85.85 0 000-1.205l-.002-.002-4.538-4.539-.002-.001a.85.85 0 00-.603-.25zm-.902-1.32a2.35 2.35 0 012.568.512v.001l4.537 4.536a2.348 2.348 0 010 3.332L8.559 23.31a2.348 2.348 0 01-3.331 0h-.001L.691 18.773v-.001a2.35 2.35 0 010-3.332l6.24-6.24a.75.75 0 01.684-.204l.473.1A.855.855 0 009.09 8.088l-.1-.474a.75.75 0 01.205-.685L15.44.691h.001a2.35 2.35 0 01.763-.513z" fill="currentColor"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7.497 15.442a.75.75 0 011.06 0l1.136 1.133a.75.75 0 010 1.061l-2.269 2.27a.75.75 0 01-1.06 0l-1.136-1.135a.75.75 0 111.061-1.06l.605.604 1.208-1.209-.604-.603a.75.75 0 010-1.061zM17.71 5.229a.75.75 0 011.061 0l1.135 1.135a.75.75 0 010 1.06l-2.27 2.27a.75.75 0 01-1.06 0L15.44 8.557a.75.75 0 011.061-1.06l.604.604 1.209-1.208-.605-.605a.75.75 0 010-1.06zm-4.539 4.539a.75.75 0 011.061 0l1.135 1.135a.75.75 0 010 1.06l-3.404 3.404a.75.75 0 01-1.06 0l-1.135-1.135a.75.75 0 111.06-1.06l.605.604 2.343-2.343-.604-.605a.75.75 0 010-1.06zM1.825 14.306a.75.75 0 011.06 0l1.134 1.136a.75.75 0 01-1.06 1.06l-1.135-1.135a.75.75 0 010-1.06zm2.268-2.269a.75.75 0 011.061 0l1.135 1.135a.75.75 0 11-1.06 1.06l-1.136-1.135a.75.75 0 010-1.06zm7.943-7.943a.75.75 0 011.061 0l1.135 1.135a.75.75 0 11-1.06 1.06l-1.136-1.135a.75.75 0 010-1.06zm2.27-2.269a.75.75 0 011.06 0l1.136 1.133a.75.75 0 01-1.06 1.062l-1.135-1.134a.75.75 0 010-1.061z" fill="currentColor"/></svg>
kind: attack
Expand Down
22 changes: 14 additions & 8 deletions actions/com.steadybit.extension_container.stress_mem/summary.mdx
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# Introduction

Allocate a specific amount of memory.
Stresses a specific amount of memory using ongoing memory allocations, reads and writes.

# Usage

Note that this can cause systems to trip the kernel OOM killer on Linux if not enough physical memory and swap is available.
Note that this can cause systems to trip the Linux Kernel OOM killer without enough physical or swap Memory.

> This action uses `stress-ng` to stress the Memory. In addition to memory consumption, due to the ongoing memory allocations, reads, and writes, CPU usage will also increase.
> If not enough CPU is available, then this attack might fail to allocate all specified Memory.
If you want to fill up the Memory without stressing the CPU, use the [Fill Memory](/action/com.steadybit.extension_container.fill_mem) action.

# Use Cases

* Test the system's ability to handle a large amount of memory
* Observe the system's behavior when it runs out of memory
* Test the system's ability to handle memory spikes.
* Observe the system's behavior when it runs out of memory or the memory bandwidth is exhausted.

# Parameters

| Parameter | Description | Default |
|----------------|-----------------------------------|---------|
| Duration | How long should memory be wasted? | 30s |
| Load on Memory | How much memory should be wasted? | 200% |
| Parameter | Description | Default |
|---------------------|------------------------------------------------------------------------------|---------|
| Duration | How long should memory be wasted? | 30s |
| Load on Host Memory | How much of the **total memory** should be used to stress the memory? | 80% |
| Fail on OOM Kill | Should it be treated as a failure when the attacked container was oomkilled? | False |
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: com.steadybit.extension_host.fill_disk
label: Fill Disk
description: Fill available disk space
description: Writes data to the disk.
icon: |
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_2810_382)">
Expand Down
10 changes: 10 additions & 0 deletions actions/com.steadybit.extension_host.fill_mem/description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
id: com.steadybit.extension_host.fill_mem
label: Fill Memory
description: Allocates and holds memory.
icon: |
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M17.106 1.498a.85.85 0 00-.602.25l-.002.003-5.959 5.954.018.084a2.354 2.354 0 01-2.77 2.776h-.007l-.08-.018-5.954 5.955-.001.002a.85.85 0 000 1.205l.001.002 4.54 4.54a.849.849 0 001.206 0l.001-.001L22.25 7.498l.001-.002a.85.85 0 000-1.205l-.002-.002-4.538-4.539-.002-.001a.85.85 0 00-.603-.25zm-.902-1.32a2.35 2.35 0 012.568.512v.001l4.537 4.536a2.348 2.348 0 010 3.332L8.559 23.31a2.348 2.348 0 01-3.331 0h-.001L.691 18.773v-.001a2.35 2.35 0 010-3.332l6.24-6.24a.75.75 0 01.684-.204l.473.1A.855.855 0 009.09 8.088l-.1-.474a.75.75 0 01.205-.685L15.44.691h.001a2.35 2.35 0 01.763-.513z" fill="currentColor"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7.497 15.442a.75.75 0 011.06 0l1.136 1.133a.75.75 0 010 1.061l-2.269 2.27a.75.75 0 01-1.06 0l-1.136-1.135a.75.75 0 111.061-1.06l.605.604 1.208-1.209-.604-.603a.75.75 0 010-1.061zM17.71 5.229a.75.75 0 011.061 0l1.135 1.135a.75.75 0 010 1.06l-2.27 2.27a.75.75 0 01-1.06 0L15.44 8.557a.75.75 0 011.061-1.06l.604.604 1.209-1.208-.605-.605a.75.75 0 010-1.06zm-4.539 4.539a.75.75 0 011.061 0l1.135 1.135a.75.75 0 010 1.06l-3.404 3.404a.75.75 0 01-1.06 0l-1.135-1.135a.75.75 0 111.06-1.06l.605.604 2.343-2.343-.604-.605a.75.75 0 010-1.06zM1.825 14.306a.75.75 0 011.06 0l1.134 1.136a.75.75 0 01-1.06 1.06l-1.135-1.135a.75.75 0 010-1.06zm2.268-2.269a.75.75 0 011.061 0l1.135 1.135a.75.75 0 11-1.06 1.06l-1.136-1.135a.75.75 0 010-1.06zm7.943-7.943a.75.75 0 011.061 0l1.135 1.135a.75.75 0 11-1.06 1.06l-1.136-1.135a.75.75 0 010-1.06zm2.27-2.269a.75.75 0 011.06 0l1.136 1.133a.75.75 0 01-1.06 1.062l-1.135-1.134a.75.75 0 010-1.061z" fill="currentColor"/></svg>
kind: attack
category: resource
targetType: com.steadybit.extension_host.host
extension: com.steadybit.extension_host
29 changes: 29 additions & 0 deletions actions/com.steadybit.extension_host.fill_mem/summary.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Introduction

Allocates a specific amount of memory.

# Usage

Note that this can cause systems to trip the Linux Kernel OOM killer without enough physical or swap Memory.
The operating system may swap out the allocated memory. This attack doesn't take swap memory into account.

In contrast to the [Stress Memory](/action/com.steadybit.extension_host.stress_mem) action, this actions tries to reduce the CPU usage as much as possible.

When using the attack to meet a specific memory usage, it may allocate or free memory to reach the desired memory usage.

> If you specify a usage that exceeds the total memory (e.g. > 100%) it fills up the memory as much as possible until the process is oomkilled, as it's impossible to reach usages higher than 100%.
# Use Cases

* Test the system's ability to handle memory spikes.
* Observe the system's behavior when it runs out of memory.
* Observe the system's behavior when it runs low on memory for file buffers.

# Parameters

| Parameter | Description | Default |
|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|
| Duration | How long should memory be wasted? | 30s |
| Mode | **Fill and meet specified usage:** Fill up the memory until the desired usage is met. Memory allocation will be adjusted constantly to meet the target.<br/> **Fill the specified amount**: Allocate and hold the specified amount of Memory. | Fill and meet specified usage |
| Size | **Percentage of total memory** or **Megabytes**: | % of total memory |
| Fail on OOM Kill | Should it be treated as a failure when the `memfill` process was oomkilled? | False |
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: com.steadybit.extension_host.stress-mem
label: Stress Memory
description: Allocate a specific amount of memory.
description: Stresses memory by ongoing reallocation, read and write operations.
icon: |
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M17.106 1.498a.85.85 0 00-.602.25l-.002.003-5.959 5.954.018.084a2.354 2.354 0 01-2.77 2.776h-.007l-.08-.018-5.954 5.955-.001.002a.85.85 0 000 1.205l.001.002 4.54 4.54a.849.849 0 001.206 0l.001-.001L22.25 7.498l.001-.002a.85.85 0 000-1.205l-.002-.002-4.538-4.539-.002-.001a.85.85 0 00-.603-.25zm-.902-1.32a2.35 2.35 0 012.568.512v.001l4.537 4.536a2.348 2.348 0 010 3.332L8.559 23.31a2.348 2.348 0 01-3.331 0h-.001L.691 18.773v-.001a2.35 2.35 0 010-3.332l6.24-6.24a.75.75 0 01.684-.204l.473.1A.855.855 0 009.09 8.088l-.1-.474a.75.75 0 01.205-.685L15.44.691h.001a2.35 2.35 0 01.763-.513z" fill="currentColor"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7.497 15.442a.75.75 0 011.06 0l1.136 1.133a.75.75 0 010 1.061l-2.269 2.27a.75.75 0 01-1.06 0l-1.136-1.135a.75.75 0 111.061-1.06l.605.604 1.208-1.209-.604-.603a.75.75 0 010-1.061zM17.71 5.229a.75.75 0 011.061 0l1.135 1.135a.75.75 0 010 1.06l-2.27 2.27a.75.75 0 01-1.06 0L15.44 8.557a.75.75 0 011.061-1.06l.604.604 1.209-1.208-.605-.605a.75.75 0 010-1.06zm-4.539 4.539a.75.75 0 011.061 0l1.135 1.135a.75.75 0 010 1.06l-3.404 3.404a.75.75 0 01-1.06 0l-1.135-1.135a.75.75 0 111.06-1.06l.605.604 2.343-2.343-.604-.605a.75.75 0 010-1.06zM1.825 14.306a.75.75 0 011.06 0l1.134 1.136a.75.75 0 01-1.06 1.06l-1.135-1.135a.75.75 0 010-1.06zm2.268-2.269a.75.75 0 011.061 0l1.135 1.135a.75.75 0 11-1.06 1.06l-1.136-1.135a.75.75 0 010-1.06zm7.943-7.943a.75.75 0 011.061 0l1.135 1.135a.75.75 0 11-1.06 1.06l-1.136-1.135a.75.75 0 010-1.06zm2.27-2.269a.75.75 0 011.06 0l1.136 1.133a.75.75 0 01-1.06 1.062l-1.135-1.134a.75.75 0 010-1.061z" fill="currentColor"/></svg>
kind: attack
Expand Down
24 changes: 12 additions & 12 deletions actions/com.steadybit.extension_host.stress-mem/summary.mdx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# Introduction

Allocate a specific amount of memory.
Stresses a specific amount of memory using ongoing memory allocations, reads and writes.

# Usage

Note that this can cause systems to trip the kernel OOM killer on Linux if not enough physical memory and swap is available.
Note that this can cause systems to trip the Linux Kernel OOM killer without enough physical or swap Memory.

# Prerequisites

If you are not using our container images for the extension, you need install the `stress-ng` tool to use the attack.
> This action uses `stress-ng` to stress the Memory. In addition to memory consumption, due to the ongoing memory allocations, reads, and writes, CPU usage will also increase.
> If not enough CPU is available, then this attack might fail to allocate all specified Memory.
If you want to fill up the Memory without stressing the CPU, use the [Fill Memory](/action/com.steadybit.extension_host.fill_mem) action.

# Use Cases

* Test the system's ability to handle a large amount of memory
* Observe the system's behavior when it runs out of memory

* Test the system's ability to handle memory spikes.
* Observe the system's behavior when it runs out of memory or the memory bandwidth is exhausted.

# Parameters

| Parameter | Description | Default |
|------------|-----------------------------------|---------|
| Duration | How long should memory be wasted? | 30s |
| Percentage | How much memory should be wasted? | 200% |
| Parameter | Description | Default |
|---------------------|-------------------------------------------------------------------------------|---------|
| Duration | How long should memory be wasted? | 30s |
| Load on Host Memory | How much of the **total memory** should be used to stress the memory? | 80% |
| Fail on OOM Kill | Should it be treated as a failure when the `stress-ng` process was oomkilled? | False |
4 changes: 3 additions & 1 deletion index.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"lastChange": 1724331843,
"lastChange": 1724665594,
"templates": [
"/templates/aws-ec2.ec2-restart/template.json",
"/templates/aws-ecs.scale-cpu-stress/template.json",
Expand Down Expand Up @@ -68,6 +68,7 @@
"/actions/com.steadybit.extension_azure.scale_set.instance.state/summary.mdx",
"/actions/com.steadybit.extension_azure.vm.state/summary.mdx",
"/actions/com.steadybit.extension_container.fill_disk/summary.mdx",
"/actions/com.steadybit.extension_container.fill_mem/summary.mdx",
"/actions/com.steadybit.extension_container.network_bandwidth/summary.mdx",
"/actions/com.steadybit.extension_container.network_blackhole/summary.mdx",
"/actions/com.steadybit.extension_container.network_block_dns/summary.mdx",
Expand All @@ -87,6 +88,7 @@
"/actions/com.steadybit.extension_gcp.vm.state/summary.mdx",
"/actions/com.steadybit.extension_grafana.alert-rule.check/summary.mdx",
"/actions/com.steadybit.extension_host.fill_disk/summary.mdx",
"/actions/com.steadybit.extension_host.fill_mem/summary.mdx",
"/actions/com.steadybit.extension_host.network_bandwidth/summary.mdx",
"/actions/com.steadybit.extension_host.network_blackhole/summary.mdx",
"/actions/com.steadybit.extension_host.network_block_dns/summary.mdx",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0a2002d

Please sign in to comment.