You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/services/schema/README.md
+51-1Lines changed: 51 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# `@hive/schema`
2
2
3
3
Service for validating schemas or verifying whether a composite GraphQL schema can be composed out
4
-
of subschemas.
4
+
of subschemas. Supports Federation, Schema Stitching and Monolithic Schemas.
5
5
6
6
## Configuration
7
7
@@ -26,3 +26,53 @@ of subschemas.
26
26
|`REQUEST_LOGGING`| No | Log http requests |`1` (enabled) or `0` (disabled) |
27
27
|`LOG_LEVEL`| No | The verbosity of the service logs. One of `trace`, `debug`, `info`, `warn` ,`error`, `fatal` or `silent`|`info` (default) |
28
28
|`OPENTELEMETRY_COLLECTOR_ENDPOINT`| No | OpenTelemetry Collector endpoint. The expected traces transport is HTTP (port `4318`). |`http://localhost:4318/v1/traces`|
29
+
30
+
## Documentation
31
+
32
+
### Composition Request Handling
33
+
34
+
The following diagram outlines how the service handles incoming composition requests via HTTP
35
+
(tRPC). It details the decision-making process around caching with Redis, reuse of in-progress
36
+
tasks, and task execution using a limited pool of worker threads.
37
+
38
+
Each composition task runs in an isolated worker thread with memory limits to prevent a single
39
+
malfunctioning task from affecting the stability of the entire service. This setup ensures robust
40
+
and efficient processing by avoiding redundant computation, serving cached results when possible,
41
+
and queuing tasks when resources are saturated.
42
+
43
+
```mermaid
44
+
sequenceDiagram
45
+
participant Client
46
+
participant Service
47
+
participant Redis
48
+
participant TaskManager
49
+
participant WorkerPool
50
+
51
+
Client->>Service: Composition HTTP request (tRPC)
52
+
Service->>Redis: Check for cached result
53
+
alt Cached result found
54
+
Redis-->>Service: Return result
55
+
Service-->>Client: Send cached result
56
+
else Not cached
57
+
Service->>TaskManager: Check if task in progress
58
+
alt Task in progress
59
+
TaskManager-->>Service: Return existing task
60
+
Service->>TaskManager: Wait for task completion
61
+
TaskManager-->>Service: Return result
62
+
Service-->>Client: Send result
63
+
else No task in progress
64
+
TaskManager->>WorkerPool: Check for available worker
65
+
alt Worker available
66
+
WorkerPool-->>TaskManager: Assign task
67
+
else No workers available
68
+
TaskManager->>TaskManager: Enqueue task in memory
69
+
TaskManager->>WorkerPool: Wait for available worker
70
+
WorkerPool-->>TaskManager: Assign task when ready
71
+
end
72
+
WorkerPool->>TaskManager: Task completed
73
+
TaskManager->>Redis: Cache result
74
+
TaskManager-->>Service: Return result to pending requests
0 commit comments