Exercise uncached session lookup for reproducible rare slow traces

This commit is contained in:
2026-11-16 03:17:45 +03:00
parent a531af3bdb
commit b602796e81
+3 -2
View File
@@ -127,7 +127,7 @@ def run_profile(client, profile, repeat):
time.sleep(delay) time.sleep(delay)
if index == 160: if index == 160:
lock_future = executor.submit(compose,'exec','-T','postgres','psql','-U','messenger','-d','messenger','-c', lock_future = executor.submit(compose,'exec','-T','postgres','psql','-U','messenger','-d','messenger','-c',
'BEGIN; LOCK TABLE users IN ACCESS EXCLUSIVE MODE; SELECT pg_sleep(0.35); COMMIT;') 'BEGIN; LOCK TABLE sessions IN ACCESS EXCLUSIVE MODE; SELECT pg_sleep(0.35); COMMIT;')
ready = [future for future in pending if future.done()] ready = [future for future in pending if future.done()]
for future in ready: for future in ready:
calls.append(future.result()) calls.append(future.result())
@@ -146,6 +146,7 @@ def run_profile(client, profile, repeat):
time.sleep(10) time.sleep(10)
after = telemetry_snapshot(instance_ids) after = telemetry_snapshot(instance_ids)
memory_after = cgroups(['api','worker','collector','tempo']) memory_after = cgroups(['api','worker','collector','tempo'])
assert any(row['kind']=='read' and row['duration_s']>=.15 for row in calls), 'Slow read probe did not occur'
rare = [row for row in calls if row['status']==500 or (row['kind']=='read' and row['duration_s']>=.15)] rare = [row for row in calls if row['status']==500 or (row['kind']=='read' and row['duration_s']>=.15)]
for row in rare: for row in rare:
row['found_in_tempo'] = exists(row['trace_id']) row['found_in_tempo'] = exists(row['trace_id'])
@@ -169,7 +170,7 @@ def main():
report = {'started_at':datetime.now(UTC).isoformat(),'track':'observability cost','runs':[], report = {'started_at':datetime.now(UTC).isoformat(),'track':'observability cost','runs':[],
'method':{'profiles':PROFILES,'repeats':3,'offered_rps':OFFERED,'measurement_s':DURATION, 'method':{'profiles':PROFILES,'repeats':3,'offered_rps':OFFERED,'measurement_s':DURATION,
'latency_clock':'client perf_counter, includes network and queueing', 'latency_clock':'client perf_counter, includes network and queueing',
'rare_slow':'one 350ms exclusive users-table lock/run', 'rare_slow':'one 350ms exclusive sessions-table lock/run',
'rare_errors':'two actual API500 after durable upload COMMIT/run through private local fault hooks', 'rare_errors':'two actual API500 after durable upload COMMIT/run through private local fault hooks',
'wire_bytes':'protobuf body length on each SDK HTTP send, retries included; excludes HTTP/TLS headers', 'wire_bytes':'protobuf body length on each SDK HTTP send, retries included; excludes HTTP/TLS headers',
'sdk_queue_losses':'conservation after 10s quiescence, separate from sampled-out spans', 'sdk_queue_losses':'conservation after 10s quiescence, separate from sampled-out spans',