Azure / Azure/data-api-builder

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

オープン
#3,567 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
2.x health-endpoint
主要言語
C#
スター
1.5k
フォーク
370
平均マージ
3日 22時間
マージ済み PR(30日)
9

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

同じ threshold-ms 値を使用して、Todo、User、Category、Product エンティティのヘルスチェックを REST と GraphQL の両方で再現します。ヘルスチェック実装が REST および GraphQL エンドポイントに対して実際に行う HTTP 呼び出しを追跡し、ミドルウェアとクエリパイプラインのオーバーヘッドを比較します。API サーフェスだけが原因で、同等のチェックが誤って Unhealthy 結果を返すことがなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, graphql
領域
api, backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。