Skip to content

Commit 31dbbd9

Browse files
committed
count operations
1 parent a191236 commit 31dbbd9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

benchmarks/test_read_latency_benchmark.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,18 @@ async def test_scan_throughput_benchmark(populated_table, duration=5):
8787
print(f"running scan throughput benchmark with scan_size={scan_size}")
8888
deadline = time.monotonic() + duration
8989
total_rows = 0
90+
total_operations = 0
9091
while time.monotonic() < deadline:
9192
start_idx = random.randint(0, max(10_000 - scan_size, 0))
9293
start_key = f"user{str(start_idx).zfill(KEY_WIDTH)}"
9394
query = ReadRowsQuery(row_ranges=RowRange(start_key=start_key), limit=scan_size)
9495
try:
95-
results = await populated_table.read_rows(query, operation_timeout=deadline - time.monotonic())
96-
total_rows += len(results)
96+
total_operations += 1
97+
async for row in await populated_table.read_rows_stream(query, operation_timeout=deadline - time.monotonic()):
98+
total_rows += 1
9799
except DeadlineExceeded as e:
98100
exc_group = e.__cause__
99101
if exc_group and any(not isinstance(exc, DeadlineExceeded) for exc in exc_group.exceptions):
100102
# found error other than deadline exceeded
101103
raise
102-
print(f"total rows: {total_rows}")
104+
print(f"total rows: {total_rows}. total operations: {total_operations}")

0 commit comments

Comments
 (0)