Skip to content

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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.

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

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