gRPC clients wait ~20 s on DNS for each connection when serverAddress is a short name

Đang mở
#611 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, grpc
Lĩnh vực
backend, networking

Hướng nghiên cứu

Start with the listed dials in core/internal/client/klioclient/grpcclient/connection.go:80 and core/cmd/admin/client.go:43, then trace the openGRPCAPIRepository dial in the Klio Kopia fork. Check how grpc-go's DNS resolver is configured and reproduce with a short serverAddress while watching CoreDNS logs. Done means short-name connections avoid the unused SRV and TXT lookups and connect without the DNS delay.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description

When serverAddress is a short name (for example klio-local.default), each
gRPC dial to the Klio server waits about 20 s before it connects.

The grpc-go dns resolver does two DNS lookups that Klio does not use:

  • SRV _grpclb._tcp.<host>
  • TXT _grpc_config.<host>

The pod has ndots:5, so these names do not match the cluster search domains.
CoreDNS sends them to the upstream DNS server. If the upstream server does not
answer, each lookup takes 10 s (5 s timeout, 2 attempts).

Kopia makes about 10 calls for each backup or restore. Because of this, a
32 MB backup takes 5 min 40 s. With the FQDN, the same backup takes 2 s.

This problem occurs in every environment where the upstream DNS is slow or
blocks SRV/TXT queries. One example is Docker Desktop 4.98.

Affected dials

  • Kopia fork (cloudnative-pg/kopia, branch klio): openGRPCAPIRepository.
    This dial causes most of the delay.
  • core/internal/client/klioclient/grpcclient/connection.go:80 (WAL streaming
    and WAL restore).
  • core/cmd/admin/client.go:43.

How to reproduce

  1. Set serverAddress to a short name, for example klio-local.default.
  2. Make sure that the upstream DNS does not answer TXT or SRV queries.
  3. Run kopia repository connect server from the klio-plugin container.
  4. Look at the CoreDNS logs. You see SRV: ... i/o timeout and
    TXT: ... i/o timeout for the server name.

Expected result

A short serverAddress connects as fast as the FQDN. Klio does not depend on
upstream DNS answers for SRV or TXT records.

Workaround

  • Use the FQDN as serverAddress and add it to the SANs of the server
    certificate.
  • Or set GRPC_ENABLE_TXT_SERVICE_CONFIG=false in the sidecar. This removes
    half of the delay.
Ngôn ngữ chính
Go
Star
40
Fork
10
Merge trung bình
19 giờ 58 phút
Pull request đã merge (30 ngày)
175

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cloudnative-pg/klio

Tất cả issue của cloudnative-pg/klio

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.