diff --git a/presto-native-execution/presto_cpp/main/common/Configs.cpp b/presto-native-execution/presto_cpp/main/common/Configs.cpp index 2be32413fd35b..ca56be1569a16 100644 --- a/presto-native-execution/presto_cpp/main/common/Configs.cpp +++ b/presto-native-execution/presto_cpp/main/common/Configs.cpp @@ -153,6 +153,7 @@ SystemConfig::SystemConfig() { NUM_PROP(kHttpServerHttp2InitialReceiveWindow, 1 << 20), NUM_PROP(kHttpServerHttp2ReceiveStreamWindowSize, 1 << 20), NUM_PROP(kHttpServerHttp2ReceiveSessionWindowSize, 10 * (1 << 20)), + NUM_PROP(kHttpServerIdleTimeoutMs, 60'000), STR_PROP( kHttpsSupportedCiphers, "ECDHE-ECDSA-AES256-GCM-SHA384,AES256-GCM-SHA384"), @@ -317,6 +318,10 @@ uint32_t SystemConfig::httpServerHttp2ReceiveSessionWindowSize() const { .value(); } +uint32_t SystemConfig::httpServerIdleTimeoutMs() const { + return optionalProperty(kHttpServerIdleTimeoutMs).value(); +} + std::string SystemConfig::httpsSupportedCiphers() const { return optionalProperty(kHttpsSupportedCiphers).value(); } diff --git a/presto-native-execution/presto_cpp/main/common/Configs.h b/presto-native-execution/presto_cpp/main/common/Configs.h index a1688173f6e18..c20a235d76a37 100644 --- a/presto-native-execution/presto_cpp/main/common/Configs.h +++ b/presto-native-execution/presto_cpp/main/common/Configs.h @@ -218,6 +218,11 @@ class SystemConfig : public ConfigBase { /// HTTP/2 receive session window size in bytes (default 10MB). static constexpr std::string_view kHttpServerHttp2ReceiveSessionWindowSize{ "http-server.http2.receive-session-window-size"}; + + /// HTTP server idle timeout in milliseconds + static constexpr std::string_view kHttpServerIdleTimeoutMs{ + "http-server.idle-timeout-ms"}; + /// List of comma separated ciphers the client can use. /// /// NOTE: the client needs to have at least one cipher shared with server @@ -817,6 +822,8 @@ class SystemConfig : public ConfigBase { uint32_t httpServerHttp2ReceiveSessionWindowSize() const; + uint32_t httpServerIdleTimeoutMs() const; + /// A list of ciphers (comma separated) that are supported by /// server and client. Note Java and folly::SSLContext use different names to /// refer to the same cipher. For e.g. TLS_RSA_WITH_AES_256_GCM_SHA384 in Java diff --git a/presto-native-execution/presto_cpp/main/http/HttpServer.cpp b/presto-native-execution/presto_cpp/main/http/HttpServer.cpp index 3179a3d25133e..cc5e77f493f2c 100644 --- a/presto-native-execution/presto_cpp/main/http/HttpServer.cpp +++ b/presto-native-execution/presto_cpp/main/http/HttpServer.cpp @@ -273,7 +273,8 @@ void HttpServer::start( std::function onSuccess, std::function onError) { proxygen::HTTPServerOptions options; - options.idleTimeout = std::chrono::milliseconds(60'000); + options.idleTimeout = std::chrono::milliseconds( + SystemConfig::instance()->httpServerIdleTimeoutMs()); options.enableContentCompression = false; proxygen::RequestHandlerChain handlerFactories;