Hi, I’m using madsim for queueing/load simulations where sub-millisecond sleeps are meaningful. In particular, I have a simulated open-loop client which samples exponential inter-arrival times. At rates like 500-1000 req/s, many sampled inter-arrivals are below 1ms, but madsim currently clamps every sleep/sleep_until to at least 1ms.
This behavior was added in #199 to fix #198, matching Tokio’s practical behavior for zero-duration sleeps. That makes sense as a default, but it changes simulator semantics for simulated systems that intentionally model sub-ms virtual time.
In my case, the clamp caused a relative-sleep open-loop load generator to under-offer load substantially:
configured 550 req/s -> about 488 req/s actually issued
configured 900 req/s -> about 689 req/s actually issued
Would you consider adding a feature flag or runtime config option to disable the 1ms minimum and allow simulated sleeps below 1ms?
Default behavior could remain unchanged, preserving the fix from #199, while some users could opt into higher time resolution.
Hi, I’m using madsim for queueing/load simulations where sub-millisecond sleeps are meaningful. In particular, I have a simulated open-loop client which samples exponential inter-arrival times. At rates like 500-1000 req/s, many sampled inter-arrivals are below 1ms, but madsim currently clamps every sleep/sleep_until to at least 1ms.
This behavior was added in #199 to fix #198, matching Tokio’s practical behavior for zero-duration sleeps. That makes sense as a default, but it changes simulator semantics for simulated systems that intentionally model sub-ms virtual time.
In my case, the clamp caused a relative-sleep open-loop load generator to under-offer load substantially:
configured 550 req/s -> about 488 req/s actually issued
configured 900 req/s -> about 689 req/s actually issued
Would you consider adding a feature flag or runtime config option to disable the 1ms minimum and allow simulated sleeps below 1ms?
Default behavior could remain unchanged, preserving the fix from #199, while some users could opt into higher time resolution.