[opt](fqdn) Add DNS Cache for FE and BE (#32869)#32995
[opt](fqdn) Add DNS Cache for FE and BE (#32869)#32995morningman merged 2 commits intoapache:branch-2.0from
Conversation
In previously, when enabling FQDN, Doris will call dns resolver to get IP from hostname
each time when 1) FE gets BE's grpc client. 2) BE gets other BE's brpc client.
So when in high concurrency case, the dns resolver be overloaded and failed to resolve hostname.
This PR mainly changes:
1. Add DNSCache for both FE and BE.
The DNSCache will run on every FE and BE node. It has a cache, key is hostname and value is IP.
Caller can get IP by hostname from this cache, and if hostname does not exist, it will try to resolve it
and update the cache.
In addition, DNSCache has a daemon thread to refresh the cache every 1 min, in case that the IP may
be changed at anytime.
There are other implements of this dns cache:
1. kaka11chen@36fed13
This is for BE side, but it does not handle the IP change case.
3. apache#28479
This is for FE side, but it can only work with Master FE. Other FE node will not be aware of the IP change.
And there are a bunch of BackendServiceProxy, this PR only handle cache in one of them.
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
|
run buildall |
| return Status::OK(); | ||
| } | ||
|
|
||
| void DNSCache::_refresh_cache() { |
There was a problem hiding this comment.
warning: method '_refresh_cache' can be made const [readability-make-member-function-const]
| void DNSCache::_refresh_cache() { | |
| void DNSCache::_refresh_cache() const { |
be/src/util/dns_cache.h:46:
- void _refresh_cache();
+ void _refresh_cache() const;| // update cache at fix internal | ||
| void _refresh_cache(); | ||
|
|
||
| private: |
There was a problem hiding this comment.
warning: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]
| private: |
Additional context
be/src/util/dns_cache.h:40: previously declared here
private:
^
TPC-H: Total hot run time: 50557 ms |
|
TeamCity be ut coverage result: |
TPC-DS: Total hot run time: 203563 ms |
ClickBench: Total hot run time: 30.42 s |
|
Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G' |
bp #32869