Skip to content

Memtier without docker #192

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

Merged
merged 5 commits into from
Feb 1, 2023
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
6 changes: 6 additions & 0 deletions redis_benchmarks_specification/__runner__/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ def create_client_runner_args(project_name):
type=int,
help="override memtier test-time for each benchmark. By default will preserve test time specified in test spec",
)
parser.add_argument(
"--benchmark_local_install",
default=False,
action="store_true",
help="Assume benchmarking tool (e.g. memtier benchmark) is installed locally and execute it without using a docker container.",
)
parser.add_argument(
"--override-test-runs",
default=1,
Expand Down
125 changes: 81 additions & 44 deletions redis_benchmarks_specification/__runner__/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ def process_self_contained_coordinator_stream(
test_tls_key,
test_tls_cacert,
resp_version,
args.benchmark_local_install,
password,
)
execute_init_commands(
Expand Down Expand Up @@ -650,32 +651,49 @@ def process_self_contained_coordinator_stream(
profiler_frequency,
profiler_call_graph_mode,
)
logging.info(
"Using docker image {} as benchmark client image (cpuset={}) with the following args: {}".format(
client_container_image,
client_cpuset_cpus,
benchmark_command_str,
)
)

# run the benchmark
benchmark_start_time = datetime.datetime.now()

client_container_stdout = docker_client.containers.run(
image=client_container_image,
volumes={
temporary_dir_client: {
"bind": client_mnt_point,
"mode": "rw",
if args.benchmark_local_install:
logging.info("Running memtier benchmark outside of docker")
benchmark_command_str = "taskset -c " + client_cpuset_cpus + " " + benchmark_command_str
logging.info(
"Running memtier benchmark command {}".format(
benchmark_command_str
)
)
stream = os.popen(benchmark_command_str)
client_container_stdout = stream.read()
move_command = "mv {} {}".format(
local_benchmark_output_filename, temporary_dir_client
)
os.system(move_command)
else:
logging.info(
"Using docker image {} as benchmark client image (cpuset={}) with the following args: {}".format(
client_container_image,
client_cpuset_cpus,
benchmark_command_str,
)
)

client_container_stdout = docker_client.containers.run(
image=client_container_image,
volumes={
temporary_dir_client: {
"bind": client_mnt_point,
"mode": "rw",
},
},
},
auto_remove=True,
privileged=True,
working_dir=benchmark_tool_workdir,
command=benchmark_command_str,
network_mode="host",
detach=False,
cpuset_cpus=client_cpuset_cpus,
)
auto_remove=True,
privileged=True,
working_dir=benchmark_tool_workdir,
command=benchmark_command_str,
network_mode="host",
detach=False,
cpuset_cpus=client_cpuset_cpus,
)

benchmark_end_time = datetime.datetime.now()
benchmark_duration_seconds = (
Expand Down Expand Up @@ -969,6 +987,7 @@ def data_prepopulation_step(
tls_key=None,
tls_cacert=None,
resp_version=None,
benchmark_local_install=False,
password=None,
):
# setup the benchmark
Expand Down Expand Up @@ -1009,32 +1028,50 @@ def data_prepopulation_step(
override_memtier_test_time_preload,
)

logging.info(
"Using docker image {} as benchmark PRELOAD image (cpuset={}) with the following args: {}".format(
preload_image,
client_cpuset_cpus,
preload_command_str,
)
)
# run the benchmark
preload_start_time = datetime.datetime.now()

client_container_stdout = docker_client.containers.run(
image=preload_image,
volumes={
temporary_dir: {
"bind": client_mnt_point,
"mode": "rw",
if benchmark_local_install:
logging.info("Running memtier benchmark outside of docker")

preload_command_str = "taskset -c " + client_cpuset_cpus + " " + preload_command_str
logging.info(
"Pre-loading using memtier benchmark command {}".format(
preload_command_str
)
)
stream = os.popen(preload_command_str)
client_container_stdout = stream.read()

move_command = "mv {} {}".format(
local_benchmark_output_filename, temporary_dir
)
os.system(move_command)

else:
logging.info(
"Using docker image {} as benchmark PRELOAD image (cpuset={}) with the following args: {}".format(
preload_image,
client_cpuset_cpus,
preload_command_str,
)
)
client_container_stdout = docker_client.containers.run(
image=preload_image,
volumes={
temporary_dir: {
"bind": client_mnt_point,
"mode": "rw",
},
},
},
auto_remove=True,
privileged=True,
working_dir=benchmark_tool_workdir,
command=preload_command_str,
network_mode="host",
detach=False,
cpuset_cpus=client_cpuset_cpus,
)
auto_remove=True,
privileged=True,
working_dir=benchmark_tool_workdir,
command=preload_command_str,
network_mode="host",
detach=False,
cpuset_cpus=client_cpuset_cpus,
)

preload_end_time = datetime.datetime.now()
preload_duration_seconds = calculate_client_tool_duration_and_check(
Expand Down