Azure / Azure/data-api-builder

[Bug]: Critical! GraphQL health checks are consistently slower than REST checks

Đang mở
#3,567 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
2.x health-endpoint
Ngôn ngữ chính
C#
Star
1.5k
Fork
372
Merge trung bình
3 ngày 22 giờ
Pull request đã merge (30 ngày)
9

Mô tả

GraphQL entity health checks consistently take 1.5-2x longer than REST checks for the same entity, leading to false `Unhealthy` results when thresholds are set based on expected query time.

## Expected

Health checks for the same entity should have comparable response times regardless of the API surface (REST vs GraphQL), since both execute the same underlying SQL query.

## Actual

Observed across multiple test runs:

| Entity | REST (ms) | GraphQL (ms) | Ratio |
|--------|-----------|-------------|-------|
| Todo | 254-306 | 553-663 | ~2x |
| User | 255-306 | 552-663 | ~2x |
| Category | 237-306 | 570-663 | ~2x |
| Product | 306 | 663 | ~2x |

This means a `threshold-ms: 500` that comfortably passes REST checks will fail GraphQL checks on first call, making the overall health status `Unhealthy` despite the database being fine.

**Root cause:** The health check implementation makes real HTTP calls to its own REST and GraphQL endpoints. GraphQL has additional overhead (Hot Chocolate query pipeline, parsing, validation, resolver execution) compared to REST's direct controller action.

**Impact:** Users setting thresholds based on database query performance will see unexpected `Unhealthy` status. The `threshold-ms` effectively needs to account for the full middleware + framework overhead, not just DB time.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Tái hiện các health check cho các entity Todo, User, Category và Product thông qua cả REST lẫn GraphQL, sử dụng cùng một giá trị threshold-ms. Truy vết các lệnh gọi HTTP thực tế của phần triển khai health check đến các endpoint REST và GraphQL, đồng thời so sánh overhead của middleware và query pipeline. Hoàn tất khi các check tương đương không còn tạo ra kết quả Unhealthy giả chỉ vì API surface.

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

Đánh giá

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

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.