Skip to content

Commit 2729ba0

Browse files
committed
Reduce ntttcp performance log volume
Expose the existing no_debug_log process option through the ntttcp and lagscope tool wrappers so noisy long-running performance commands can suppress per-line stdout logging without losing captured output. Enable the option in perf_ntttcp for the ntttcp server/client and lagscope latency sidecar commands. This keeps result parsing intact while reducing DEBUG file log growth during high-connection retry loops.
1 parent 94a82b3 commit 2729ba0

5 files changed

Lines changed: 57 additions & 9 deletions

File tree

lisa/microsoft/testsuites/performance/common.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,8 @@ def perf_ntttcp( # noqa: C901
514514
lagscope_server_ip
515515
if lagscope_server_ip is not None
516516
else server.internal_address
517-
)
517+
),
518+
no_debug_log=True,
518519
)
519520

520521
# Start ntttcp server asynchronously to accept incoming
@@ -530,6 +531,7 @@ def perf_ntttcp( # noqa: C901
530531
buffer_size=buffer_size,
531532
dev_differentiator=dev_differentiator,
532533
udp_mode=udp_mode,
534+
no_debug_log=True,
533535
)
534536

535537
# Start lagscope client to measure latency during the
@@ -544,6 +546,7 @@ def perf_ntttcp( # noqa: C901
544546
length_of_histogram_intervals=0,
545547
count_of_histogram_intervals=0,
546548
dump_csv=False,
549+
no_debug_log=True,
547550
)
548551

549552
# Run ntttcp client and monitor for hangs
@@ -556,6 +559,7 @@ def perf_ntttcp( # noqa: C901
556559
ports_count=num_threads_p,
557560
dev_differentiator=dev_differentiator,
558561
udp_mode=udp_mode,
562+
no_debug_log=True,
559563
)
560564

561565
# Stop the server and collect results from both client

lisa/tools/lagscope.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,17 @@ def restore_busy_poll(self) -> None:
136136
for key in self._busy_pool_keys:
137137
sysctl.write(key, self._original_settings[key])
138138

139-
def run_as_server_async(self, ip: str = "") -> Process:
139+
def run_as_server_async(self, ip: str = "", no_debug_log: bool = False) -> Process:
140140
# -r: run as a receiver
141141
# -rip: run as server mode with specified ip address
142142
cmd = ""
143143
if ip:
144144
cmd += f" -r{ip}"
145145
else:
146146
cmd += " -r"
147-
process = self.run_async(cmd, sudo=True, shell=True, force_run=True)
147+
process = self.run_async(
148+
cmd, sudo=True, shell=True, force_run=True, no_debug_log=no_debug_log
149+
)
148150
if not process.is_running():
149151
raise LisaException("lagscope server failed to start")
150152
if not self.node.tools[Lsof].is_port_opened_per_process_name(self.command):
@@ -164,6 +166,7 @@ def run_as_client_async(
164166
count_of_histogram_intervals: int = 30,
165167
dump_csv: bool = True,
166168
daemon: bool = False,
169+
no_debug_log: bool = False,
167170
) -> Process:
168171
# -s: run as a sender
169172
# -i: test interval
@@ -197,7 +200,7 @@ def run_as_client_async(
197200
cmd += " -P "
198201
if dump_csv:
199202
cmd += f" -RLatency-{get_datetime_path()}.csv "
200-
process = self.node.execute_async(cmd, shell=True)
203+
process = self.node.execute_async(cmd, shell=True, no_debug_log=no_debug_log)
201204
return process
202205

203206
def run_as_client(
@@ -213,6 +216,7 @@ def run_as_client(
213216
count_of_histogram_intervals: int = 30,
214217
dump_csv: bool = True,
215218
daemon: bool = False,
219+
no_debug_log: bool = False,
216220
) -> ExecutableResult:
217221
process = self.run_as_client_async(
218222
server_ip,
@@ -226,6 +230,7 @@ def run_as_client(
226230
count_of_histogram_intervals,
227231
dump_csv,
228232
daemon,
233+
no_debug_log,
229234
)
230235

231236
result = process.wait_result()
@@ -533,7 +538,7 @@ def restore_busy_poll(self) -> None:
533538
# This is not supported on FreeBSD.
534539
return
535540

536-
def run_as_server_async(self, ip: str = "") -> Process:
541+
def run_as_server_async(self, ip: str = "", no_debug_log: bool = False) -> Process:
537542
return self.node.tools[Sockperf].start_server_async("tcp")
538543

539544
def run_as_client_async(
@@ -549,6 +554,7 @@ def run_as_client_async(
549554
count_of_histogram_intervals: int = 30,
550555
dump_csv: bool = True,
551556
daemon: bool = False,
557+
no_debug_log: bool = False,
552558
) -> Process:
553559
return self.node.tools[Sockperf].run_client_async("tcp", server_ip)
554560

@@ -565,6 +571,7 @@ def run_as_client(
565571
count_of_histogram_intervals: int = 30,
566572
dump_csv: bool = True,
567573
daemon: bool = False,
574+
no_debug_log: bool = False,
568575
) -> ExecutableResult:
569576
process = self.run_as_client_async(
570577
server_ip,
@@ -578,6 +585,7 @@ def run_as_client(
578585
count_of_histogram_intervals,
579586
dump_csv,
580587
daemon,
588+
no_debug_log,
581589
)
582590
result = process.wait_result()
583591
return result

lisa/tools/ntttcp.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ def run_as_server_async(
214214
dev_differentiator: str = "Hypervisor callback interrupts",
215215
run_as_daemon: bool = False,
216216
udp_mode: bool = False,
217+
no_debug_log: bool = False,
217218
) -> Process:
218219
cmd = ""
219220
if server_ip:
@@ -236,6 +237,7 @@ def run_as_server_async(
236237
f"ulimit -n 204800 && {self.pre_command}{self.command} {cmd}",
237238
shell=True,
238239
sudo=True,
240+
no_debug_log=no_debug_log,
239241
)
240242
# NTTTCP for Linux 1.4.0
241243
# ---------------------------------------------------------
@@ -258,6 +260,7 @@ def run_as_server(
258260
dev_differentiator: str = "Hypervisor callback interrupts",
259261
run_as_daemon: bool = False,
260262
udp_mode: bool = False,
263+
no_debug_log: bool = False,
261264
) -> ExecutableResult:
262265
# -rserver_ip: run as a receiver with specified server ip address
263266
# -P: Number of ports listening on receiver side [default: 16] [max: 512]
@@ -286,6 +289,7 @@ def run_as_server(
286289
dev_differentiator,
287290
run_as_daemon,
288291
udp_mode,
292+
no_debug_log,
289293
)
290294

291295
return self.wait_server_result(process)
@@ -309,6 +313,7 @@ def run_as_client_async(
309313
dev_differentiator: str = "Hypervisor callback interrupts",
310314
run_as_daemon: bool = False,
311315
udp_mode: bool = False,
316+
no_debug_log: bool = False,
312317
) -> Process:
313318
cmd = (
314319
f" -s{server_ip} -P {ports_count} -n {threads_count} -t {run_time_seconds} "
@@ -325,6 +330,7 @@ def run_as_client_async(
325330
f"ulimit -n 204800 && {self.pre_command}{self.command} {cmd}",
326331
shell=True,
327332
sudo=True,
333+
no_debug_log=no_debug_log,
328334
)
329335
return process
330336

@@ -342,6 +348,7 @@ def run_as_client(
342348
run_as_daemon: bool = False,
343349
udp_mode: bool = False,
344350
tolerance_seconds: int = 60,
351+
no_debug_log: bool = False,
345352
) -> ExecutableResult:
346353
# -sserver_ip: run as a sender with server ip address
347354
# -P: Number of ports listening on receiver side [default: 16] [max: 512]
@@ -373,6 +380,7 @@ def run_as_client(
373380
dev_differentiator,
374381
run_as_daemon,
375382
udp_mode,
383+
no_debug_log,
376384
)
377385
return process.wait_result(
378386
expected_exit_code=0,
@@ -868,6 +876,7 @@ def run_as_server_async(
868876
dev_differentiator: str = "Hypervisor callback interrupts",
869877
run_as_daemon: bool = False,
870878
udp_mode: bool = False,
879+
no_debug_log: bool = False,
871880
) -> Process:
872881
assert server_ip, "server ip is required for ntttcp server"
873882
self._log.debug(
@@ -889,6 +898,7 @@ def run_as_server_async(
889898
f"ulimit -n 204800 && {self.pre_command}{self.command} {cmd}",
890899
shell=True,
891900
sudo=True,
901+
no_debug_log=no_debug_log,
892902
)
893903
time.sleep(5)
894904

@@ -908,6 +918,7 @@ def run_as_client(
908918
run_as_daemon: bool = False,
909919
udp_mode: bool = False,
910920
tolerance_seconds: int = 60,
921+
no_debug_log: bool = False,
911922
) -> ExecutableResult:
912923
self._log.debug(
913924
"Paramers nic_name, cool_down_time_seconds, warm_up_time_seconds, "
@@ -928,6 +939,7 @@ def run_as_client(
928939
expected_exit_code=0,
929940
expected_exit_code_failure_message=f"fail to run {self.command} {cmd}",
930941
timeout=run_time_seconds + tolerance_seconds,
942+
no_debug_log=no_debug_log,
931943
)
932944
return result
933945

lisa/util/logger.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,17 @@ def _filter_secrets(self, value: Any) -> Any:
9999

100100

101101
class LogWriter(object):
102-
def __init__(self, logger: Logger, level: int):
102+
def __init__(
103+
self,
104+
logger: Logger,
105+
level: int,
106+
capture_stream: Optional[TextIO] = None,
107+
):
103108
self._level = level
104109
self._log = logger
105110
self._buffer: str = ""
106111
self._flushing: bool = False
112+
self._capture_stream = capture_stream
107113

108114
def write(self, message: str) -> None:
109115
if not self._flushing:
@@ -117,7 +123,10 @@ def flush(self) -> None:
117123
try:
118124
buffer = self._buffer
119125
self._buffer = ""
120-
self._log.lines(self._level, buffer)
126+
if self._capture_stream:
127+
self._capture_stream.write(buffer)
128+
if self._level != logging.NOTSET:
129+
self._log.lines(self._level, buffer)
121130
finally:
122131
self._flushing = False
123132

lisa/util/process.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,25 @@ def start(
257257
if no_error_log:
258258
stderr_level = stdout_level
259259

260+
stdout_capture_stream = (
261+
self.log_buffer if stdout_level == logging.NOTSET else None
262+
)
263+
stderr_capture_stream = (
264+
self.log_buffer if stderr_level == logging.NOTSET else None
265+
)
266+
260267
self.stdout_logger = get_logger("stdout", parent=self._log)
261268
self.stderr_logger = get_logger("stderr", parent=self._log)
262-
self._stdout_writer = LogWriter(logger=self.stdout_logger, level=stdout_level)
263-
self._stderr_writer = LogWriter(logger=self.stderr_logger, level=stderr_level)
269+
self._stdout_writer = LogWriter(
270+
logger=self.stdout_logger,
271+
level=stdout_level,
272+
capture_stream=stdout_capture_stream,
273+
)
274+
self._stderr_writer = LogWriter(
275+
logger=self.stderr_logger,
276+
level=stderr_level,
277+
capture_stream=stderr_capture_stream,
278+
)
264279

265280
self._log_handler = logging.StreamHandler(self.log_buffer)
266281
msg_only_format = logging.Formatter(fmt="%(message)s", datefmt="")

0 commit comments

Comments
 (0)