diff --git a/be/src/common/config.h b/be/src/common/config.h index 0be21a4f1c7e2d..97a5ccb319d0fb 100644 --- a/be/src/common/config.h +++ b/be/src/common/config.h @@ -597,6 +597,10 @@ namespace config { // the load process will reject new incoming load job of this tablet. // This is to avoid too many version num. CONF_mInt32(max_tablet_version_num, "500"); + + // Frontend mainly use two thrift sever type: THREAD_POOL, THREADED. if fe use THREADED model for thrift server, + // the thrift_server_type_of_fe should be set THREADED to make be thrift client to fe constructed with TFramedTransport + CONF_String(thrift_server_type_of_fe, "THREAD_POOL"); } // namespace config diff --git a/be/src/runtime/client_cache.h b/be/src/runtime/client_cache.h index fbcaede544223c..69a51ecd177fd4 100644 --- a/be/src/runtime/client_cache.h +++ b/be/src/runtime/client_cache.h @@ -270,11 +270,22 @@ class ClientCache { // Factory method to produce a new ThriftClient for the wrapped cache ThriftClientImpl* make_client(const TNetworkAddress& hostport, void** client_key) { - Client* client = new Client(hostport.hostname, hostport.port); + static ThriftServer::ServerType server_type = get_thrift_server_type(); + Client* client = new Client(hostport.hostname, hostport.port, server_type); *client_key = reinterpret_cast(client->iface()); return client; } + // since service type is multiple, we should set thrift server type here for be thrift client + ThriftServer::ServerType get_thrift_server_type() { + auto &thrift_server_type = config::thrift_server_type_of_fe; + transform(thrift_server_type.begin(), thrift_server_type.end(), thrift_server_type.begin(), toupper); + if (strcmp(typeid(T).name(), "N5doris21FrontendServiceClientE") == 0 && thrift_server_type == "THREADED") { + return ThriftServer::ServerType::THREADED; + } else { + return ThriftServer::ServerType::THREAD_POOL; + } + } }; // Doris backend client cache, used by a backend to send requests diff --git a/be/src/util/thrift_client.h b/be/src/util/thrift_client.h index fbee380a9deda0..69b729e38d49b6 100644 --- a/be/src/util/thrift_client.h +++ b/be/src/util/thrift_client.h @@ -139,17 +139,12 @@ ThriftClient::ThriftClient( _iface(new InterfaceType(_protocol)) { switch (server_type) { case ThriftServer::NON_BLOCKING: - // The Nonblocking server is disabled at this time. There are - // issues with the framed protocol throwing negative frame size errors. - LOG(WARNING) << "Nonblocking server usage is experimental"; + case ThriftServer::THREADED: _transport.reset(new apache::thrift::transport::TFramedTransport(_socket)); break; - case ThriftServer::THREAD_POOL: - case ThriftServer::THREADED: _transport.reset(new apache::thrift::transport::TBufferedTransport(_socket)); break; - default: std::stringstream error_msg; error_msg << "Unsupported server type: " << server_type; diff --git a/docs/en/administrator-guide/config/be_config.md b/docs/en/administrator-guide/config/be_config.md index 0fc5325b53d4ff..48b13cf70b7a57 100644 --- a/docs/en/administrator-guide/config/be_config.md +++ b/docs/en/administrator-guide/config/be_config.md @@ -646,6 +646,14 @@ If the system is found to be in a high-stress scenario and a large number of thr ### `thrift_rpc_timeout_ms` +### `thrift_server_type_of_fe` + +This configuration indicates the service model used by FE's Thrift service. The type is string and is case-insensitive. This parameter needs to be consistent with the setting of fe's thrift_server_type parameter. Currently there are two values for this parameter, `THREADED` and `THREAD_POOL`. + +If the parameter is `THREADED`, the model is a non-blocking I/O model, + +If the parameter is `THREAD_POOL`, the model is a blocking I/O model. + ### `trash_file_expire_time_sec` ### `txn_commit_rpc_timeout_ms` diff --git a/docs/zh-CN/administrator-guide/config/be_config.md b/docs/zh-CN/administrator-guide/config/be_config.md index f931f5904d908e..6ebfad70f54ff0 100644 --- a/docs/zh-CN/administrator-guide/config/be_config.md +++ b/docs/zh-CN/administrator-guide/config/be_config.md @@ -641,6 +641,14 @@ Stream Load 一般适用于导入几个GB以内的数据,不适合导入过大 ### `thrift_rpc_timeout_ms` +### `thrift_server_type_of_fe` + +该配置表示FE的Thrift服务使用的服务模型, 类型为string, 大小写不敏感,该参数需要和fe的thrift_server_type参数的设置保持一致。目前该参数的取值有两个,`THREADED`和`THREAD_POOL`。 + +若该参数为`THREADED`, 该模型为非阻塞式I/O模型, + +若该参数为`THREAD_POOL`, 该模型为阻塞式I/O模型。 + ### `trash_file_expire_time_sec` ### `txn_commit_rpc_timeout_ms`