SIGN IN SIGN UP

test/common: reduce WebCache stress-test thread count

WebCacheConcurrencyTest sized its thread pool as hardware_concurrency() * 100,
which is 3200 on the 32-vCPU CI hosts. Linux runs that in a few seconds, but
the Windows (mingw-llvm/libc++) build times out unittest_web_cache at the
1800s per-test limit on every PR.

BasicAddSame reuses one key, so after the first insert every add() is a
shared-lock hit: 3200 threads log hit=3200000 miss=1 and finish in ~4s.
BasicAddUnique inserts a distinct key each iteration, so every add() misses
and takes the exclusive lock. libc++'s std::shared_mutex wakes all waiting
writers on every unlock, so N contending writers cost O(N^2) wakeups. At
N=3200 that alone overruns the 1800s budget, which is where the failing run
hangs. StampedeSyncCallOnce and StampedeMutex are exclusive-lock bound the
same way.

The tests only need enough threads to race; 4x oversubscription is enough.
Cap the count via a shared helper.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
K
Kefu Chai committed
7240994bf53deabdfaf137a74cf886693682f4e9
Parent: 66b1546