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

Stress-ng customisation of timeout #51

Merged
merged 1 commit into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generator/src/pkg/service/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const (
EpExecModeDefault = "sequential"
EpNwResponseSizeDefault = 512

EpExecTimeDefault = "1s"
EpExecTimeDefault = "0.1s"
EpMethodDefault = "all"
EpWorkersDefault = 1
EpLoadDefault = "5%"
Expand Down
25 changes: 24 additions & 1 deletion model/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,36 @@ FROM python:3.8.0-slim

RUN mkdir -p /usr/src/app
RUN apt update
RUN apt upgrade -y
RUN apt install -y jq \
wget \
stress-ng \
2to3

RUN apt install -y libbsd-dev \
libcap-dev \
libipsec-mb-dev \
libjudy-dev \
libkeyutils-dev \
libsctp-dev \
libatomic1 \
zlib1g-dev \
libkmod-dev \
libxxhash-dev \
git \
build-essential

WORKDIR /usr/src/app

RUN git clone https://github.com/alekodu/stress-ng.git &&\
cd stress-ng/ &&\
git checkout cloudsim &&\
Copy link
Collaborator

Choose a reason for hiding this comment

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

The branch name just shocked me, there is a tool called cloudsim!

make clean &&\
make &&\
mv stress-ng my-stress-ng &&\
cp my-stress-ng /usr/src/app &&\
cd .. &&\
rm -R stress-ng/

ADD ./requirements.txt /usr/src/app/requirements.txt

RUN pip install --upgrade pip
Expand Down
6 changes: 3 additions & 3 deletions model/restful/utils/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ def run_task(service_name, service_endpoint):

def execute_cpu_bounded_task(conf):
if len(conf["cpu_affinity"]) > 0:
res = subprocess.run(['stress-ng --class cpu --cpu %s --cpu-method %s --taskset %s --cpu-load %s --timeout %s --metrics-brief' % (conf["workers"], conf["method"], ",".join(str(cpu_id) for cpu_id in conf["cpu_affinity"]), conf["cpu_load"], conf["execution_time"])], capture_output=True, shell=True)
res = subprocess.run(['/usr/src/app/my-stress-ng --class cpu --cpu %s --cpu-method %s --taskset %s --cpu-load %s --timeout %s --metrics-brief' % (conf["workers"], conf["method"], ",".join(str(cpu_id) for cpu_id in conf["cpu_affinity"]), conf["cpu_load"], conf["execution_time"])], capture_output=True, shell=True)
else:
res = subprocess.run(['stress-ng --class cpu --cpu %s --cpu-method %s --cpu-load %s --timeout %s --metrics-brief' % (conf["workers"], conf["method"], conf["cpu_load"], conf["execution_time"])], capture_output=True, shell=True)
res = subprocess.run(['/usr/src/app/my-stress-ng --class cpu --cpu %s --cpu-method %s --cpu-load %s --timeout %s --metrics-brief' % (conf["workers"], conf["method"], conf["cpu_load"], conf["execution_time"])], capture_output=True, shell=True)

return res.stderr.decode("utf-8"), "cpu"


def execute_memory_bounded_task(conf):
res = subprocess.run(['stress-ng --class memory --vm %s --vm-method %s --vm-bytes %s --timeout %s --metrics-brief' % (conf["workers"], conf["method"], conf["bytes_load"], conf["execution_time"])], capture_output=True, shell=True)
res = subprocess.run(['/usr/src/app/my-stress-ng --class memory --vm %s --vm-method %s --vm-bytes %s --timeout %s --metrics-brief' % (conf["workers"], conf["method"], conf["bytes_load"], conf["execution_time"])], capture_output=True, shell=True)

return res.stderr.decode("utf-8"), "memory"

Expand Down