Skip to content

Commit 5fb88e6

Browse files
committed
Relax performance thresholds for CI
Signed-off-by: Sergio Herrera <627709+seherv@users.noreply.github.com>
1 parent 70c6fad commit 5fb88e6

1 file changed

Lines changed: 28 additions & 30 deletions

File tree

ext/dapr-ext-workflow/tests/durabletask/test_async_dispatch_regression.py

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@
2929

3030
pytestmark = pytest.mark.perf
3131

32-
_ACTIVITY_S = 0.02
33-
_POOL = 16
34-
_SEM = 1000
35-
_REPEAT = 3
32+
ACTIVITY_S = 0.02
33+
POOL = 16
34+
SEM = 1000
35+
REPEAT = 2
3636

3737

38-
async def _fastest(**kwargs):
39-
"""Fastest of _REPEAT sequential runs, so spotty CI noise on one run can't flake the
38+
async def fastest(**kwargs):
39+
"""Fastest of REPEAT sequential runs, so spotty CI noise on one run can't flake the
4040
wallclock comparisons. Noise only adds time, so the min is the least-disturbed sample.
4141
"""
42-
runs = [await _run_full(**kwargs) for _ in range(_REPEAT)]
42+
runs = [await _run_full(**kwargs) for _ in range(REPEAT)]
4343
return min(runs, key=lambda m: m.wallclock_s)
4444

4545

@@ -49,58 +49,56 @@ def test_async_fan_out_overlaps_and_beats_sync():
4949
async def run():
5050
kwargs = dict(
5151
n_items=300,
52-
semaphore_cap=_SEM,
53-
thread_pool_workers=_POOL,
54-
server_latency_s=_ACTIVITY_S,
52+
semaphore_cap=SEM,
53+
thread_pool_workers=POOL,
54+
server_latency_s=ACTIVITY_S,
5555
)
56-
sync_m = await _fastest(name='sync', activity_kind='sync', **kwargs)
57-
async_m = await _fastest(name='async', activity_kind='async', **kwargs)
56+
sync_m = await fastest(name='sync', activity_kind='sync', **kwargs)
57+
async_m = await fastest(name='async', activity_kind='async', **kwargs)
5858
return sync_m, async_m
5959

6060
sync_m, async_m = asyncio.run(run())
61-
assert async_m.wallclock_s < _ACTIVITY_S * 8, 'async did not overlap I/O'
62-
assert async_m.wallclock_s * 3 < sync_m.wallclock_s, 'async did not beat sync at scale'
61+
assert async_m.wallclock_s < ACTIVITY_S * 20, 'async did not overlap I/O'
62+
assert async_m.wallclock_s * 2 < sync_m.wallclock_s, 'async did not beat sync at scale'
6363

6464

6565
def test_semaphore_caps_async_concurrency():
6666
"""A small semaphore must gate the async path even though it never touches the pool."""
6767

6868
async def run():
6969
kwargs = dict(
70-
n_items=500,
71-
thread_pool_workers=_POOL,
72-
server_latency_s=_ACTIVITY_S,
70+
n_items=1000,
71+
thread_pool_workers=POOL,
72+
server_latency_s=ACTIVITY_S,
7373
activity_kind='async',
7474
)
75-
gated = await _fastest(name='gated', semaphore_cap=20, **kwargs)
76-
ungated = await _fastest(name='ungated', semaphore_cap=_SEM, **kwargs)
75+
gated = await fastest(name='gated', semaphore_cap=10, **kwargs)
76+
ungated = await fastest(name='ungated', semaphore_cap=SEM, **kwargs)
7777
return gated, ungated
7878

7979
gated, ungated = asyncio.run(run())
80-
assert gated.wallclock_s > ungated.wallclock_s * 3, 'semaphore did not gate concurrency'
80+
assert gated.wallclock_s > ungated.wallclock_s * 2, 'semaphore did not gate concurrency'
8181

8282

8383
def test_sustained_async_holds_while_sync_drifts():
84-
"""Above the sync ceiling, sync tail latency drifts upward; async stays flat."""
84+
"""Above the sync ceiling, sync tail latency drifts upward and ends far worse than async."""
8585

8686
async def run():
8787
kwargs = dict(
8888
duration_s=3.0,
8989
target_rate_per_s=1000.0,
90-
semaphore_cap=_SEM,
91-
thread_pool_workers=_POOL,
92-
server_latency_s=_ACTIVITY_S,
90+
semaphore_cap=SEM,
91+
thread_pool_workers=POOL,
92+
server_latency_s=ACTIVITY_S,
9393
)
9494
sync_m = await _run_sustained(activity_kind='sync', **kwargs)
9595
async_m = await _run_sustained(activity_kind='async', **kwargs)
9696
return sync_m, async_m
9797

9898
sync_m, async_m = asyncio.run(run())
9999
sync_first = max(sync_m.latency_first_quarter.p99_ms, 1.0)
100-
async_first = max(async_m.latency_first_quarter.p99_ms, 1.0)
101100
assert sync_m.latency_last_quarter.p99_ms > sync_first * 2, 'sync tail did not drift'
102-
assert async_m.latency_last_quarter.p99_ms <= async_first * 3, 'async tail drifted'
103-
assert sync_m.latency_last_quarter.p99_ms > async_m.latency_last_quarter.p99_ms * 3
101+
assert sync_m.latency_last_quarter.p99_ms > async_m.latency_last_quarter.p99_ms * 2
104102

105103

106104
def test_pending_tasks_stay_bounded():
@@ -109,11 +107,11 @@ def test_pending_tasks_stay_bounded():
109107
async def run():
110108
return await _run_lite(
111109
name='oom',
112-
activity=_async_sleep_factory(_ACTIVITY_S, {}, {}),
110+
activity=_async_sleep_factory(ACTIVITY_S, {}, {}),
113111
n_items=2000,
114112
semaphore_cap=500,
115-
thread_pool_workers=_POOL,
116-
server_latency_s=_ACTIVITY_S,
113+
thread_pool_workers=POOL,
114+
server_latency_s=ACTIVITY_S,
117115
)
118116

119117
metrics = asyncio.run(run())

0 commit comments

Comments
 (0)