Azure / Azure/data-api-builder
[Bug]: Critical! GraphQL health checks are consistently slower than REST checks
- Vorherrschende Sprache
- C#
- Sterne
- 1.5k
- Forks
- 370
- Ø Merge
- 3 T. 22 Std.
- Gemergte PRs (30 T.)
- 9
Beschreibung
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.
Beitragsleitfaden
Rechercherichtung
Reproduziere die Health Checks für die Entitäten Todo, User, Category und Product sowohl über REST als auch über GraphQL und verwende dabei denselben threshold-ms-Wert. Verfolge die tatsächlichen HTTP-Aufrufe der Implementierung des Health Checks zu den REST- und GraphQL-Endpunkten und vergleiche den Overhead der Middleware und der Query-Pipeline. Die Aufgabe ist abgeschlossen, wenn äquivalente Checks nicht mehr allein aufgrund der API-Oberfläche fälschlicherweise den Status Unhealthy liefern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp, graphql
- Bereich
- api, backend
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100