Skip to content

Comments

BytemanHelper memory stress: add ability to define how much heap memory is used#21

Open
mkorosec wants to merge 1 commit intochaos-mesh:mainfrom
mkorosec:main
Open

BytemanHelper memory stress: add ability to define how much heap memory is used#21
mkorosec wants to merge 1 commit intochaos-mesh:mainfrom
mkorosec:main

Conversation

@mkorosec
Copy link

@mkorosec mkorosec commented Apr 3, 2025

Usage

RULE heap-99
CLASS org.chaos_mesh.chaos_agent.TriggerThread
METHOD triggerFunc
HELPER org.chaos_mesh.byteman.helper.StressHelper
AT ENTRY
IF true
DO
    injectLimitedMemStress("heap-99", "heap", "0.99");
ENDRULE

Some other examples for the usedHeap value that work: 50%, 100MB, 1GB, 0.5

How to test

Writting this down for anyone wanting to try this out before it's taken into the official release.

Simplest way is to locally rebuild the docker image used for the chaos-daemon and then use this new image in your k8s cluster.

Dockerfile

FROM ghcr.io/chaos-mesh/chaos-daemon:v2.7.1
COPY byteman-helper.jar /usr/local/byteman/lib/byteman-helper.jar

build the image locally

cd BytemanHelper
mvn clean package
cp target/byteman-helper*.jar {where you placed the Dockerfile}/byteman-helper.jar
cd {where you placed the Dockerfile}
docker build -t chaos-daemon:v2.7.1-byteman-helper .

use the locally built image in your k8s repo

kubectl patch daemonset chaos-daemon -n chaos-mesh -p '{"spec": {"template": {"spec":{"containers":[{"image":"chaos-daemon:v2.7.1-byteman-helper", "name": "chaos-daemon"}]}}}}'

@chaotic-prow
Copy link

chaotic-prow bot commented Apr 3, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mkorosec

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

…ry is used

Signed-off-by: Matej Korosec <ce-matej.korosec@beyondnow.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant