Skip to content

Commit 1ad4fdb

Browse files
Allowing to specify different host on local runner. Collecting extra server side metrics on local run. (#425)
* Enabled pushing timeseries data from local run * Exposing memory metrics on local run * Allowing to specify different host on local runner * Bumping version from 0.10.24 to 0.10.25
1 parent de8031b commit 1ad4fdb

File tree

4 files changed

+83
-71
lines changed

4 files changed

+83
-71
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redisbench-admin"
3-
version = "0.10.24"
3+
version = "0.10.25"
44
description = "Redis benchmark run helper. A wrapper around Redis and Redis Modules benchmark tools ( ftsb_redisearch, memtier_benchmark, redis-benchmark, aibench, etc... )."
55
authors = ["filipecosta90 <filipecosta.90@gmail.com>","Redis Performance Group <performance@redis.com>"]
66
readme = "README.md"

redisbench_admin/run_local/args.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,30 @@
88
from redisbench_admin.run.args import common_run_args
99
from redisbench_admin.run.common import REDIS_BINARY
1010

11-
FLUSHALL_AT_START = bool(int(os.getenv("FLUSHALL_AT_START", "0")))
11+
FLUSHALL_AT_START = bool(int(os.getenv("FLUSHALL_AT_START", "1")))
1212
IGNORE_KEYSPACE_ERRORS = bool(int(os.getenv("IGNORE_KEYSPACE_ERRORS", "0")))
13+
SKIP_REDIS_SPIN = bool(int(os.getenv("SKIP_REDIS_SPIN", "0")))
14+
REDIS_PORT = int(os.getenv("SKIP_REDIS_SPIN", "6379"))
15+
REDIS_HOST = os.getenv("REDIS_HOST", "127.0.0.1")
1316

1417

1518
def create_run_local_arguments(parser):
1619
parser = common_run_args(parser)
17-
parser.add_argument("--port", type=int, default=6379)
20+
parser.add_argument("--port", type=int, default=REDIS_PORT)
21+
parser.add_argument("--host", type=str, default=REDIS_HOST)
1822
parser.add_argument("--redis-binary", type=str, default=REDIS_BINARY)
1923
parser.add_argument(
2024
"--flushall_on_every_test_start",
2125
type=bool,
2226
default=FLUSHALL_AT_START,
2327
help="At the start of every test send a FLUSHALL",
2428
)
29+
parser.add_argument(
30+
"--skip-redis-spin",
31+
type=bool,
32+
default=SKIP_REDIS_SPIN,
33+
help="Skip redis spin. consider redis alive at host:port",
34+
)
2535
parser.add_argument(
2636
"--ignore_keyspace_errors",
2737
type=bool,

redisbench_admin/run_local/local_db.py

Lines changed: 69 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -79,84 +79,86 @@ def local_db_spin(
7979
redis_processes,
8080
)
8181
else:
82-
# setup Redis
83-
# copy the rdb to DB machine
84-
redis_7 = args.redis_7
85-
logging.info(
86-
"Using local temporary dir to spin up Redis Instance. Path: {}".format(
87-
temporary_dir
88-
)
89-
)
90-
if dbdir_folder is not None:
91-
from distutils.dir_util import copy_tree
92-
93-
copy_tree(dbdir_folder, temporary_dir)
82+
if args.skip_redis_spin is False:
83+
# setup Redis
84+
# copy the rdb to DB machine
85+
redis_7 = args.redis_7
9486
logging.info(
95-
"Copied entire content of {} into temporary path: {}".format(
96-
dbdir_folder, temporary_dir
87+
"Using local temporary dir to spin up Redis Instance. Path: {}".format(
88+
temporary_dir
9789
)
9890
)
99-
(
100-
_,
101-
_,
102-
redis_configuration_parameters,
103-
dataset_load_timeout_secs,
104-
modules_configuration_parameters_map,
105-
) = extract_redis_dbconfig_parameters(benchmark_config, "dbconfig")
91+
if dbdir_folder is not None:
92+
from distutils.dir_util import copy_tree
10693

107-
logging.info(
108-
"Using a dataset load timeout of {} seconds.".format(
109-
dataset_load_timeout_secs
110-
)
111-
)
112-
113-
if setup_type == "oss-cluster":
114-
cluster_api_enabled = True
115-
shard_host = "127.0.0.1"
116-
redis_processes, redis_conns = spin_up_local_redis_cluster(
117-
binary,
118-
temporary_dir,
119-
shard_count,
120-
shard_host,
121-
args.port,
122-
local_module_file,
94+
copy_tree(dbdir_folder, temporary_dir)
95+
logging.info(
96+
"Copied entire content of {} into temporary path: {}".format(
97+
dbdir_folder, temporary_dir
98+
)
99+
)
100+
(
101+
_,
102+
_,
123103
redis_configuration_parameters,
124104
dataset_load_timeout_secs,
125105
modules_configuration_parameters_map,
126-
redis_7,
127-
)
106+
) = extract_redis_dbconfig_parameters(benchmark_config, "dbconfig")
128107

129-
status = setup_redis_cluster_from_conns(
130-
redis_conns, shard_count, shard_host, args.port
131-
)
132-
if status is False:
133-
raise Exception("Redis cluster setup failed. Failing test.")
134-
135-
if setup_type == "oss-standalone":
136-
redis_processes = spin_up_local_redis(
137-
binary,
138-
args.port,
139-
temporary_dir,
140-
local_module_file,
141-
redis_configuration_parameters,
142-
dbdir_folder,
143-
dataset_load_timeout_secs,
144-
modules_configuration_parameters_map,
145-
redis_7,
108+
logging.info(
109+
"Using a dataset load timeout of {} seconds.".format(
110+
dataset_load_timeout_secs
111+
)
146112
)
147-
if setup_type == "oss-cluster":
148-
for shardn, redis_process in enumerate(redis_processes):
149-
logging.info(
150-
"Checking if shard #{} process with pid={} is alive".format(
151-
shardn + 1, redis_process.pid
152-
)
113+
114+
if setup_type == "oss-cluster":
115+
cluster_api_enabled = True
116+
redis_processes, redis_conns = spin_up_local_redis_cluster(
117+
binary,
118+
temporary_dir,
119+
shard_count,
120+
args.host,
121+
args.port,
122+
local_module_file,
123+
redis_configuration_parameters,
124+
dataset_load_timeout_secs,
125+
modules_configuration_parameters_map,
126+
redis_7,
127+
)
128+
129+
status = setup_redis_cluster_from_conns(
130+
redis_conns, shard_count, args.host, args.port
131+
)
132+
if status is False:
133+
raise Exception("Redis cluster setup failed. Failing test.")
134+
135+
if setup_type == "oss-standalone":
136+
redis_processes = spin_up_local_redis(
137+
binary,
138+
args.port,
139+
temporary_dir,
140+
local_module_file,
141+
redis_configuration_parameters,
142+
dbdir_folder,
143+
dataset_load_timeout_secs,
144+
modules_configuration_parameters_map,
145+
redis_7,
153146
)
154-
if is_process_alive(redis_process) is False:
155-
raise Exception("Redis process is not alive. Failing test.")
156-
cluster_init_steps(clusterconfig, redis_conns, local_module_file)
147+
if setup_type == "oss-cluster":
148+
for shardn, redis_process in enumerate(redis_processes):
149+
logging.info(
150+
"Checking if shard #{} process with pid={} is alive".format(
151+
shardn + 1, redis_process.pid
152+
)
153+
)
154+
if is_process_alive(redis_process) is False:
155+
raise Exception("Redis process is not alive. Failing test.")
156+
cluster_init_steps(clusterconfig, redis_conns, local_module_file)
157+
else:
158+
logging.info("Skipping DB spin step...")
157159

158160
if setup_type == "oss-standalone":
159-
r = redis.Redis(port=args.port)
161+
r = redis.Redis(port=args.port, host=args.host)
160162
r.ping()
161163
r.client_setname("redisbench-admin-standalone")
162164
redis_conns.append(r)
@@ -184,7 +186,7 @@ def local_db_spin(
184186
benchmark_config,
185187
full_benchmark_path,
186188
args.port,
187-
"localhost",
189+
args.host,
188190
local_benchmark_output_filename,
189191
False,
190192
benchmark_tool_workdir,

redisbench_admin/run_local/run_local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def run_local_command_logic(args, project_name, project_version):
290290
benchmark_config,
291291
full_benchmark_path,
292292
args.port,
293-
"127.0.0.1",
293+
args.host,
294294
local_benchmark_output_filename,
295295
False,
296296
benchmark_tool_workdir,

0 commit comments

Comments
 (0)