Loading test/httpd_h1_offload_test.cpp +12 −5 Original line number Diff line number Diff line Loading @@ -210,7 +210,14 @@ int main() { // Test 2: enough concurrent slow requests to saturate every epoll/kqueue // worker thread must not delay an unrelated fast request when H1 offload // is enabled, but must delay it when disabled (default/off). // Uses double the core count rather than exactly hardware_concurrency() -- // on a busy shared machine, a handful of workers can be momentarily tied up // by unrelated scheduling noise, which would let the "sync" baseline dodge // saturation by pure luck and read as a false failure. Comfortable // over-subscription makes that essentially impossible without weakening // what the offload case is expected to prove. const unsigned workerCount = (std::max)(1u, std::thread::hardware_concurrency()); const unsigned slowConnCount = workerCount * 2; const int slowDelayMs = 300; // Returns -1 on any failure (connection/response trouble) instead of throwing -- Loading @@ -223,8 +230,8 @@ int main() { long long result = -1; try { std::vector<std::unique_ptr<netplus::tcp>> slowSocks(workerCount); for (unsigned i = 0; i < workerCount; ++i) { std::vector<std::unique_ptr<netplus::tcp>> slowSocks(slowConnCount); for (unsigned i = 0; i < slowConnCount; ++i) { slowSocks[i] = std::make_unique<netplus::tcp>(); rawtcp::connectLocal(*slowSocks[i], port); std::ostringstream req; Loading Loading @@ -257,7 +264,7 @@ int main() { }; long long syncMs = runSaturationCase(/*h1OffloadThreads=*/0); std::cout << "[sync] fast request latency while " << workerCount std::cout << "[sync] fast request latency while " << slowConnCount << " slow requests saturate every worker: " << syncMs << "ms " "(expect >= ~" << slowDelayMs / 2 << "ms, blocked)" << std::endl; if (syncMs < slowDelayMs / 2) { Loading @@ -268,8 +275,8 @@ int main() { ++failures; } long long offloadMs = runSaturationCase(/*h1OffloadThreads=*/workerCount + 4); std::cout << "[offload] fast request latency while " << workerCount long long offloadMs = runSaturationCase(/*h1OffloadThreads=*/slowConnCount + 4); std::cout << "[offload] fast request latency while " << slowConnCount << " slow requests saturate every worker: " << offloadMs << "ms " "(expect < ~" << slowDelayMs / 2 << "ms, unaffected)" << std::endl; if (offloadMs < 0 || offloadMs >= slowDelayMs / 2) { Loading Loading
test/httpd_h1_offload_test.cpp +12 −5 Original line number Diff line number Diff line Loading @@ -210,7 +210,14 @@ int main() { // Test 2: enough concurrent slow requests to saturate every epoll/kqueue // worker thread must not delay an unrelated fast request when H1 offload // is enabled, but must delay it when disabled (default/off). // Uses double the core count rather than exactly hardware_concurrency() -- // on a busy shared machine, a handful of workers can be momentarily tied up // by unrelated scheduling noise, which would let the "sync" baseline dodge // saturation by pure luck and read as a false failure. Comfortable // over-subscription makes that essentially impossible without weakening // what the offload case is expected to prove. const unsigned workerCount = (std::max)(1u, std::thread::hardware_concurrency()); const unsigned slowConnCount = workerCount * 2; const int slowDelayMs = 300; // Returns -1 on any failure (connection/response trouble) instead of throwing -- Loading @@ -223,8 +230,8 @@ int main() { long long result = -1; try { std::vector<std::unique_ptr<netplus::tcp>> slowSocks(workerCount); for (unsigned i = 0; i < workerCount; ++i) { std::vector<std::unique_ptr<netplus::tcp>> slowSocks(slowConnCount); for (unsigned i = 0; i < slowConnCount; ++i) { slowSocks[i] = std::make_unique<netplus::tcp>(); rawtcp::connectLocal(*slowSocks[i], port); std::ostringstream req; Loading Loading @@ -257,7 +264,7 @@ int main() { }; long long syncMs = runSaturationCase(/*h1OffloadThreads=*/0); std::cout << "[sync] fast request latency while " << workerCount std::cout << "[sync] fast request latency while " << slowConnCount << " slow requests saturate every worker: " << syncMs << "ms " "(expect >= ~" << slowDelayMs / 2 << "ms, blocked)" << std::endl; if (syncMs < slowDelayMs / 2) { Loading @@ -268,8 +275,8 @@ int main() { ++failures; } long long offloadMs = runSaturationCase(/*h1OffloadThreads=*/workerCount + 4); std::cout << "[offload] fast request latency while " << workerCount long long offloadMs = runSaturationCase(/*h1OffloadThreads=*/slowConnCount + 4); std::cout << "[offload] fast request latency while " << slowConnCount << " slow requests saturate every worker: " << offloadMs << "ms " "(expect < ~" << slowDelayMs / 2 << "ms, unaffected)" << std::endl; if (offloadMs < 0 || offloadMs >= slowDelayMs / 2) { Loading