@fjell/registry 4.4.52 → 4.4.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/API.md +0 -62
- package/GETTING_STARTED.md +0 -69
- package/build.js +0 -38
- package/docs/README.md +0 -74
- package/docs/TIMING_NODE_OPTIMIZATION.md +0 -207
- package/docs/TIMING_README.md +0 -170
- package/docs/docs.config.ts +0 -114
- package/docs/index.html +0 -26
- package/docs/package-lock.json +0 -5129
- package/docs/package.json +0 -34
- package/docs/public/404.html +0 -53
- package/docs/public/GETTING_STARTED.md +0 -69
- package/docs/public/README.md +0 -623
- package/docs/public/TIMING_NODE_OPTIMIZATION.md +0 -207
- package/docs/public/api.md +0 -62
- package/docs/public/client-api-overview.md +0 -137
- package/docs/public/configuration.md +0 -759
- package/docs/public/error-handling/README.md +0 -356
- package/docs/public/error-handling/network-errors.md +0 -485
- package/docs/public/examples/coordinates-example.ts +0 -253
- package/docs/public/examples/multi-level-keys.ts +0 -374
- package/docs/public/examples/registry-hub-coordinates-example.ts +0 -370
- package/docs/public/examples/registry-hub-types.ts +0 -437
- package/docs/public/examples/simple-example.ts +0 -250
- package/docs/public/examples-README.md +0 -241
- package/docs/public/fjell-icon.svg +0 -1
- package/docs/public/icon.png +0 -0
- package/docs/public/icon2.png +0 -0
- package/docs/public/memory-overhead.svg +0 -120
- package/docs/public/memory.md +0 -430
- package/docs/public/operations/README.md +0 -121
- package/docs/public/operations/all.md +0 -325
- package/docs/public/operations/create.md +0 -415
- package/docs/public/operations/get.md +0 -389
- package/docs/public/package.json +0 -63
- package/docs/public/pano.png +0 -0
- package/docs/public/pano2.png +0 -0
- package/docs/public/timing-range.svg +0 -176
- package/docs/public/timing.md +0 -483
- package/docs/timing-range.svg +0 -174
- package/docs/vitest.config.ts +0 -14
- package/examples/README.md +0 -241
- package/examples/coordinates-example.ts +0 -253
- package/examples/multi-level-keys.ts +0 -382
- package/examples/registry-hub-coordinates-example.ts +0 -370
- package/examples/registry-hub-types.ts +0 -437
- package/examples/registry-statistics-example.ts +0 -264
- package/examples/simple-example.ts +0 -250
- package/tsconfig.docs.json +0 -28
- package/vitest.config.ts +0 -22
package/docs/public/memory.md
DELETED
|
@@ -1,430 +0,0 @@
|
|
|
1
|
-
# Registry Memory Consumption Analysis
|
|
2
|
-
|
|
3
|
-
> **Generated:** 2025-07-21T04:04:11.643Z
|
|
4
|
-
> **Version:** 4.4.7
|
|
5
|
-
> **Node.js:** v22.0.0
|
|
6
|
-
> **Test Environment:** darwin arm64
|
|
7
|
-
|
|
8
|
-
## Executive Summary
|
|
9
|
-
|
|
10
|
-
This document provides a comprehensive analysis of memory efficiency for the Fjell Registry library infrastructure. The tests focus on measuring memory overhead per registry instance to ensure optimal memory scaling and efficiency in production environments.
|
|
11
|
-
|
|
12
|
-
"Memory efficiency per instance" refers to the average amount of memory used by each registry instance, helping identify how memory usage scales as the number of instances increases.
|
|
13
|
-
|
|
14
|
-
## Memory Test Results
|
|
15
|
-
|
|
16
|
-
| Operation | Description | Memory Delta | Per Instance | Avg Time (ms) | Threshold | Status |
|
|
17
|
-
|-----------|-------------|--------------|--------------|---------------|-----------|--------|
|
|
18
|
-
| registryCreation | Memory overhead of creating a Registry instance | 72.50 kB | N/A | 0.000 | 83.01 kB | ✅ PASS |
|
|
19
|
-
| registryHubCreation | Memory overhead of creating a RegistryHub instance | 79.55 kB | N/A | 0.001 | 83.01 kB | ✅ PASS |
|
|
20
|
-
| coordinateCreation | Memory overhead of creating Coordinate instances | 112.55 kB | 1.13 kB | 0.001 | 488.28 kB | ✅ PASS |
|
|
21
|
-
| instanceCreation | Memory overhead of creating Instance objects | 158.22 kB | 1.58 kB | 0.001 | 244.14 kB | ✅ PASS |
|
|
22
|
-
| registryStorage | Memory growth when registering instances in registry | 310.70 kB | 3.11 kB | 0.004 | 390.63 kB | ✅ PASS |
|
|
23
|
-
| multiLevelTree | Memory overhead of multi-level instance tree structures | 215.16 kB | 4.30 kB | 0.005 | 585.94 kB | ✅ PASS |
|
|
24
|
-
| scopedInstances | Memory overhead of instances with multiple scopes | 304.58 kB | 3.05 kB | 0.003 | 610.35 kB | ✅ PASS |
|
|
25
|
-
| registryHubIntegration | Memory overhead of RegistryHub managing multiple registries | 276.75 kB | 2.77 kB | 0.008 | 2.29 MB | ✅ PASS |
|
|
26
|
-
|
|
27
|
-
## Memory Efficiency Scaling Analysis (Statistical)
|
|
28
|
-
|
|
29
|
-
### Per-Instance Memory Efficiency Results
|
|
30
|
-
|
|
31
|
-
| Instance Count | Iterations | Memory Per Instance (Avg ± StdDev) | Time (Avg ± StdDev) | Status |
|
|
32
|
-
|----------------|------------|-------------------------------------|---------------------|--------|
|
|
33
|
-
| 10 | 50 | 3.10 kB ± 4.00 kB | 0.06 ± 0.16 ms | ✅ PASS |
|
|
34
|
-
| 20 | 50 | 2.76 kB ± 2.08 kB | 0.11 ± 0.46 ms | ✅ PASS |
|
|
35
|
-
| 50 | 50 | 2.43 kB ± 2.83 kB | 0.10 ± 0.35 ms | ✅ PASS |
|
|
36
|
-
| 100 | 50 | 2.14 kB ± 1.76 kB | 0.17 ± 0.36 ms | ✅ PASS |
|
|
37
|
-
| 200 | 50 | 2.27 kB ± 2.26 kB | 0.63 ± 1.35 ms | ✅ PASS |
|
|
38
|
-
| 500 | 25 | 2.01 kB ± 1.43 kB | 2.73 ± 3.86 ms | ✅ PASS |
|
|
39
|
-
| 1,000 | 25 | 1.99 kB ± 1.75 kB | 5.18 ± 6.83 ms | ✅ PASS |
|
|
40
|
-
| 2,000 | 25 | 1.86 kB ± 1.59 kB | 4.94 ± 3.50 ms | ✅ PASS |
|
|
41
|
-
| 5,000 | 10 | 1.90 kB ± 1.11 kB | 16.26 ± 4.33 ms | ✅ PASS |
|
|
42
|
-
| 10,000 | 10 | 1.46 kB ± 816 B | 21.16 ± 5.97 ms | ✅ PASS |
|
|
43
|
-
|
|
44
|
-
### Detailed Statistical Analysis
|
|
45
|
-
|
|
46
|
-
#### 10 Instances (50 iterations)
|
|
47
|
-
|
|
48
|
-
**Memory Per Instance:**
|
|
49
|
-
- Average: 3.10 kB
|
|
50
|
-
- Range: 200 B - 28.18 kB
|
|
51
|
-
- Standard Deviation: 4.00 kB
|
|
52
|
-
|
|
53
|
-
**Creation Time:**
|
|
54
|
-
- Average: 0.06 ms
|
|
55
|
-
- Range: 0.01 - 1.14 ms
|
|
56
|
-
- Standard Deviation: 0.16 ms
|
|
57
|
-
|
|
58
|
-
#### 20 Instances (50 iterations)
|
|
59
|
-
|
|
60
|
-
**Memory Per Instance:**
|
|
61
|
-
- Average: 2.76 kB
|
|
62
|
-
- Range: 200 B - 12.40 kB
|
|
63
|
-
- Standard Deviation: 2.08 kB
|
|
64
|
-
|
|
65
|
-
**Creation Time:**
|
|
66
|
-
- Average: 0.11 ms
|
|
67
|
-
- Range: 0.02 - 3.28 ms
|
|
68
|
-
- Standard Deviation: 0.46 ms
|
|
69
|
-
|
|
70
|
-
#### 50 Instances (50 iterations)
|
|
71
|
-
|
|
72
|
-
**Memory Per Instance:**
|
|
73
|
-
- Average: 2.43 kB
|
|
74
|
-
- Range: 200 B - 18.86 kB
|
|
75
|
-
- Standard Deviation: 2.83 kB
|
|
76
|
-
|
|
77
|
-
**Creation Time:**
|
|
78
|
-
- Average: 0.10 ms
|
|
79
|
-
- Range: 0.04 - 2.56 ms
|
|
80
|
-
- Standard Deviation: 0.35 ms
|
|
81
|
-
|
|
82
|
-
#### 100 Instances (50 iterations)
|
|
83
|
-
|
|
84
|
-
**Memory Per Instance:**
|
|
85
|
-
- Average: 2.14 kB
|
|
86
|
-
- Range: 200 B - 10.54 kB
|
|
87
|
-
- Standard Deviation: 1.76 kB
|
|
88
|
-
|
|
89
|
-
**Creation Time:**
|
|
90
|
-
- Average: 0.17 ms
|
|
91
|
-
- Range: 0.08 - 2.65 ms
|
|
92
|
-
- Standard Deviation: 0.36 ms
|
|
93
|
-
|
|
94
|
-
#### 200 Instances (50 iterations)
|
|
95
|
-
|
|
96
|
-
**Memory Per Instance:**
|
|
97
|
-
- Average: 2.27 kB
|
|
98
|
-
- Range: 200 B - 11.64 kB
|
|
99
|
-
- Standard Deviation: 2.26 kB
|
|
100
|
-
|
|
101
|
-
**Creation Time:**
|
|
102
|
-
- Average: 0.63 ms
|
|
103
|
-
- Range: 0.17 - 7.49 ms
|
|
104
|
-
- Standard Deviation: 1.35 ms
|
|
105
|
-
|
|
106
|
-
#### 500 Instances (25 iterations)
|
|
107
|
-
|
|
108
|
-
**Memory Per Instance:**
|
|
109
|
-
- Average: 2.01 kB
|
|
110
|
-
- Range: 200 B - 7.61 kB
|
|
111
|
-
- Standard Deviation: 1.43 kB
|
|
112
|
-
|
|
113
|
-
**Creation Time:**
|
|
114
|
-
- Average: 2.73 ms
|
|
115
|
-
- Range: 0.43 - 14.56 ms
|
|
116
|
-
- Standard Deviation: 3.86 ms
|
|
117
|
-
|
|
118
|
-
#### 1,000 Instances (25 iterations)
|
|
119
|
-
|
|
120
|
-
**Memory Per Instance:**
|
|
121
|
-
- Average: 1.99 kB
|
|
122
|
-
- Range: 200 B - 7.61 kB
|
|
123
|
-
- Standard Deviation: 1.75 kB
|
|
124
|
-
|
|
125
|
-
**Creation Time:**
|
|
126
|
-
- Average: 5.18 ms
|
|
127
|
-
- Range: 0.81 - 31.10 ms
|
|
128
|
-
- Standard Deviation: 6.83 ms
|
|
129
|
-
|
|
130
|
-
#### 2,000 Instances (25 iterations)
|
|
131
|
-
|
|
132
|
-
**Memory Per Instance:**
|
|
133
|
-
- Average: 1.86 kB
|
|
134
|
-
- Range: 607 B - 6.69 kB
|
|
135
|
-
- Standard Deviation: 1.59 kB
|
|
136
|
-
|
|
137
|
-
**Creation Time:**
|
|
138
|
-
- Average: 4.94 ms
|
|
139
|
-
- Range: 1.82 - 11.65 ms
|
|
140
|
-
- Standard Deviation: 3.50 ms
|
|
141
|
-
|
|
142
|
-
#### 5,000 Instances (10 iterations)
|
|
143
|
-
|
|
144
|
-
**Memory Per Instance:**
|
|
145
|
-
- Average: 1.90 kB
|
|
146
|
-
- Range: 1.26 kB - 4.30 kB
|
|
147
|
-
- Standard Deviation: 1.11 kB
|
|
148
|
-
|
|
149
|
-
**Creation Time:**
|
|
150
|
-
- Average: 16.26 ms
|
|
151
|
-
- Range: 11.01 - 21.74 ms
|
|
152
|
-
- Standard Deviation: 4.33 ms
|
|
153
|
-
|
|
154
|
-
#### 10,000 Instances (10 iterations)
|
|
155
|
-
|
|
156
|
-
**Memory Per Instance:**
|
|
157
|
-
- Average: 1.46 kB
|
|
158
|
-
- Range: 200 B - 3.61 kB
|
|
159
|
-
- Standard Deviation: 816 B
|
|
160
|
-
|
|
161
|
-
**Creation Time:**
|
|
162
|
-
- Average: 21.16 ms
|
|
163
|
-
- Range: 14.28 - 32.53 ms
|
|
164
|
-
- Standard Deviation: 5.97 ms
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
### Memory Efficiency Pattern (Statistical Summary)
|
|
168
|
-
|
|
169
|
-
The following data shows per-instance memory efficiency with confidence intervals:
|
|
170
|
-
|
|
171
|
-
```
|
|
172
|
-
Instance Count | Avg Per Instance | StdDev %
|
|
173
|
-
10 | 3.10 kB | 129.1%
|
|
174
|
-
20 | 2.76 kB | 75.4%
|
|
175
|
-
50 | 2.43 kB | 116.5%
|
|
176
|
-
100 | 2.14 kB | 82.3%
|
|
177
|
-
200 | 2.27 kB | 99.4%
|
|
178
|
-
500 | 2.01 kB | 71.3%
|
|
179
|
-
1000 | 1.99 kB | 88.0%
|
|
180
|
-
2000 | 1.86 kB | 85.3%
|
|
181
|
-
5000 | 1.90 kB | 58.6%
|
|
182
|
-
10000 | 1.46 kB | 54.7%
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### Statistical Reliability
|
|
186
|
-
|
|
187
|
-
- **Sample Sizes**: 10: 50 iterations, 20: 50 iterations, 50: 50 iterations, 100: 50 iterations, 200: 50 iterations, 500: 25 iterations, 1000: 25 iterations, 2000: 25 iterations, 5000: 10 iterations, 10000: 10 iterations
|
|
188
|
-
- **Data Quality**: All measurements include statistical analysis with standard deviations
|
|
189
|
-
- **Outlier Detection**: Raw data files available in `./docs/memory-data/` for detailed analysis
|
|
190
|
-
- **Confidence**: Standard deviations indicate measurement reliability and consistency
|
|
191
|
-
|
|
192
|
-
### Scaling Characteristics (Statistical)
|
|
193
|
-
|
|
194
|
-
- **Per-Instance Memory Change**: -11.3% (2.14 kB → 1.90 kB)
|
|
195
|
-
- **Memory Efficiency**: Good
|
|
196
|
-
- **Per-Instance Consistency**: Excellent (< 1KB variation)
|
|
197
|
-
- **Statistical Confidence**: High (multiple iterations with standard deviation analysis)
|
|
198
|
-
|
|
199
|
-
## Detailed Memory Analysis
|
|
200
|
-
|
|
201
|
-
### registryCreation
|
|
202
|
-
|
|
203
|
-
**Description:** Memory overhead of creating a Registry instance
|
|
204
|
-
**Iterations:** 100
|
|
205
|
-
**Total Memory Delta:** 72.50 kB
|
|
206
|
-
**Memory Per Instance:** N/A
|
|
207
|
-
**Average Time:** 0.000 ms
|
|
208
|
-
|
|
209
|
-
**Memory Breakdown:**
|
|
210
|
-
- Heap Used: 72.50 kB
|
|
211
|
-
- Heap Total: 0 B
|
|
212
|
-
- External: 40 B
|
|
213
|
-
- RSS: 0 B
|
|
214
|
-
|
|
215
|
-
**Memory Threshold:** 83.01 kB
|
|
216
|
-
**Time Threshold:** 1 ms
|
|
217
|
-
**Status:** ✅ PASS
|
|
218
|
-
|
|
219
|
-
### registryHubCreation
|
|
220
|
-
|
|
221
|
-
**Description:** Memory overhead of creating a RegistryHub instance
|
|
222
|
-
**Iterations:** 100
|
|
223
|
-
**Total Memory Delta:** 79.55 kB
|
|
224
|
-
**Memory Per Instance:** N/A
|
|
225
|
-
**Average Time:** 0.001 ms
|
|
226
|
-
|
|
227
|
-
**Memory Breakdown:**
|
|
228
|
-
- Heap Used: 79.55 kB
|
|
229
|
-
- Heap Total: 0 B
|
|
230
|
-
- External: 0 B
|
|
231
|
-
- RSS: 0 B
|
|
232
|
-
|
|
233
|
-
**Memory Threshold:** 83.01 kB
|
|
234
|
-
**Time Threshold:** 1.5 ms
|
|
235
|
-
**Status:** ✅ PASS
|
|
236
|
-
|
|
237
|
-
### coordinateCreation
|
|
238
|
-
|
|
239
|
-
**Description:** Memory overhead of creating Coordinate instances
|
|
240
|
-
**Iterations:** 100
|
|
241
|
-
**Total Memory Delta:** 112.55 kB
|
|
242
|
-
**Memory Per Instance:** 1.13 kB
|
|
243
|
-
**Average Time:** 0.001 ms
|
|
244
|
-
|
|
245
|
-
**Memory Breakdown:**
|
|
246
|
-
- Heap Used: 112.55 kB
|
|
247
|
-
- Heap Total: 0 B
|
|
248
|
-
- External: 0 B
|
|
249
|
-
- RSS: 0 B
|
|
250
|
-
|
|
251
|
-
**Memory Threshold:** 488.28 kB
|
|
252
|
-
**Time Threshold:** 0.5 ms
|
|
253
|
-
**Status:** ✅ PASS
|
|
254
|
-
|
|
255
|
-
### instanceCreation
|
|
256
|
-
|
|
257
|
-
**Description:** Memory overhead of creating Instance objects
|
|
258
|
-
**Iterations:** 100
|
|
259
|
-
**Total Memory Delta:** 158.22 kB
|
|
260
|
-
**Memory Per Instance:** 1.58 kB
|
|
261
|
-
**Average Time:** 0.001 ms
|
|
262
|
-
|
|
263
|
-
**Memory Breakdown:**
|
|
264
|
-
- Heap Used: 158.22 kB
|
|
265
|
-
- Heap Total: 0 B
|
|
266
|
-
- External: 0 B
|
|
267
|
-
- RSS: 0 B
|
|
268
|
-
|
|
269
|
-
**Memory Threshold:** 244.14 kB
|
|
270
|
-
**Time Threshold:** 1 ms
|
|
271
|
-
**Status:** ✅ PASS
|
|
272
|
-
|
|
273
|
-
### registryStorage
|
|
274
|
-
|
|
275
|
-
**Description:** Memory growth when registering instances in registry
|
|
276
|
-
**Iterations:** 100
|
|
277
|
-
**Total Memory Delta:** 310.70 kB
|
|
278
|
-
**Memory Per Instance:** 3.11 kB
|
|
279
|
-
**Average Time:** 0.004 ms
|
|
280
|
-
|
|
281
|
-
**Memory Breakdown:**
|
|
282
|
-
- Heap Used: 310.70 kB
|
|
283
|
-
- Heap Total: 0 B
|
|
284
|
-
- External: 0 B
|
|
285
|
-
- RSS: 0 B
|
|
286
|
-
|
|
287
|
-
**Memory Threshold:** 390.63 kB
|
|
288
|
-
**Time Threshold:** 1.5 ms
|
|
289
|
-
**Status:** ✅ PASS
|
|
290
|
-
|
|
291
|
-
### multiLevelTree
|
|
292
|
-
|
|
293
|
-
**Description:** Memory overhead of multi-level instance tree structures
|
|
294
|
-
**Iterations:** 50
|
|
295
|
-
**Total Memory Delta:** 215.16 kB
|
|
296
|
-
**Memory Per Instance:** 4.30 kB
|
|
297
|
-
**Average Time:** 0.005 ms
|
|
298
|
-
|
|
299
|
-
**Memory Breakdown:**
|
|
300
|
-
- Heap Used: 215.16 kB
|
|
301
|
-
- Heap Total: 0 B
|
|
302
|
-
- External: 0 B
|
|
303
|
-
- RSS: 0 B
|
|
304
|
-
|
|
305
|
-
**Memory Threshold:** 585.94 kB
|
|
306
|
-
**Time Threshold:** 2 ms
|
|
307
|
-
**Status:** ✅ PASS
|
|
308
|
-
|
|
309
|
-
### scopedInstances
|
|
310
|
-
|
|
311
|
-
**Description:** Memory overhead of instances with multiple scopes
|
|
312
|
-
**Iterations:** 100
|
|
313
|
-
**Total Memory Delta:** 304.58 kB
|
|
314
|
-
**Memory Per Instance:** 3.05 kB
|
|
315
|
-
**Average Time:** 0.003 ms
|
|
316
|
-
|
|
317
|
-
**Memory Breakdown:**
|
|
318
|
-
- Heap Used: 304.58 kB
|
|
319
|
-
- Heap Total: 0 B
|
|
320
|
-
- External: 0 B
|
|
321
|
-
- RSS: 0 B
|
|
322
|
-
|
|
323
|
-
**Memory Threshold:** 610.35 kB
|
|
324
|
-
**Time Threshold:** 2 ms
|
|
325
|
-
**Status:** ✅ PASS
|
|
326
|
-
|
|
327
|
-
### registryHubIntegration
|
|
328
|
-
|
|
329
|
-
**Description:** Memory overhead of RegistryHub managing multiple registries
|
|
330
|
-
**Iterations:** 20
|
|
331
|
-
**Total Memory Delta:** 276.75 kB
|
|
332
|
-
**Memory Per Instance:** 2.77 kB
|
|
333
|
-
**Average Time:** 0.008 ms
|
|
334
|
-
|
|
335
|
-
**Memory Breakdown:**
|
|
336
|
-
- Heap Used: 276.75 kB
|
|
337
|
-
- Heap Total: 0 B
|
|
338
|
-
- External: 0 B
|
|
339
|
-
- RSS: 0 B
|
|
340
|
-
|
|
341
|
-
**Memory Threshold:** 2.29 MB
|
|
342
|
-
**Time Threshold:** 5 ms
|
|
343
|
-
**Status:** ✅ PASS
|
|
344
|
-
|
|
345
|
-
## Memory Constraints
|
|
346
|
-
|
|
347
|
-
The following memory constraints are enforced to ensure optimal memory usage:
|
|
348
|
-
|
|
349
|
-
### Infrastructure Overhead
|
|
350
|
-
- **Registry Creation**: ≤ 83.01 kB
|
|
351
|
-
- **Registry Hub Creation**: ≤ 83.01 kB
|
|
352
|
-
- **Maximum Registry Overhead**: ≤ 117.19 kB
|
|
353
|
-
|
|
354
|
-
### Per-Instance Overhead
|
|
355
|
-
- **Instance Creation**: ≤ 2.44 kB per instance
|
|
356
|
-
- **Coordinate Creation**: ≤ 4.88 kB per coordinate
|
|
357
|
-
- **Instance Tree Node**: ≤ 3.91 kB per tree node
|
|
358
|
-
- **Maximum Memory Per Instance**: ≤ 4.88 kB
|
|
359
|
-
|
|
360
|
-
### Memory Efficiency Analysis
|
|
361
|
-
|
|
362
|
-
The memory efficiency analysis focuses on per-instance memory overhead and how it scales with the number of instances.
|
|
363
|
-
|
|
364
|
-
- **Registry Overhead Efficiency**: 12.7% under constraint limit
|
|
365
|
-
- **Per-Instance Efficiency**: 67.6% under constraint limit
|
|
366
|
-
|
|
367
|
-
## Performance Characteristics
|
|
368
|
-
|
|
369
|
-
### Memory Efficiency Scaling
|
|
370
|
-
- **Per-Instance Consistency**: Memory overhead per instance remains relatively constant as instance count increases
|
|
371
|
-
- **Statistical Validation**: Multiple iterations ensure reliable measurements of per-instance efficiency
|
|
372
|
-
- **Low Variance**: Small standard deviations indicate consistent per-instance memory usage
|
|
373
|
-
- **Predictable Efficiency**: Memory efficiency per instance is predictable and optimized
|
|
374
|
-
|
|
375
|
-
### Optimization Features
|
|
376
|
-
- **Efficient Data Structures**: Uses optimized tree structures for instance storage
|
|
377
|
-
- **Minimal Overhead**: Core registry infrastructure has very low memory footprint
|
|
378
|
-
- **Consistent Performance**: Statistical analysis shows reliable memory patterns
|
|
379
|
-
|
|
380
|
-
## Data Files
|
|
381
|
-
|
|
382
|
-
Raw measurement data is available in the following files:
|
|
383
|
-
- `./docs/memory-data/scaling-10-instances.json`
|
|
384
|
-
- `./docs/memory-data/scaling-20-instances.json`
|
|
385
|
-
- `./docs/memory-data/scaling-50-instances.json`
|
|
386
|
-
- `./docs/memory-data/scaling-100-instances.json`
|
|
387
|
-
- `./docs/memory-data/scaling-200-instances.json`
|
|
388
|
-
- `./docs/memory-data/scaling-500-instances.json`
|
|
389
|
-
- `./docs/memory-data/scaling-1000-instances.json`
|
|
390
|
-
- `./docs/memory-data/scaling-2000-instances.json`
|
|
391
|
-
- `./docs/memory-data/scaling-5000-instances.json`
|
|
392
|
-
- `./docs/memory-data/scaling-10000-instances.json`
|
|
393
|
-
|
|
394
|
-
These files contain all individual measurements, allowing for detailed statistical analysis and trend identification.
|
|
395
|
-
|
|
396
|
-
## Recommendations
|
|
397
|
-
|
|
398
|
-
### Memory Management
|
|
399
|
-
1. **Monitor Instance Count**: Keep track of total instances across all registries
|
|
400
|
-
2. **Statistical Analysis**: Use the statistical data to understand memory variance
|
|
401
|
-
3. **Trend Analysis**: Review raw data files to identify memory usage patterns
|
|
402
|
-
4. **Cleanup**: Ensure proper cleanup of unused instances and registries
|
|
403
|
-
|
|
404
|
-
### Performance Optimization
|
|
405
|
-
1. **Batch Operations**: Create instances in batches when possible
|
|
406
|
-
2. **Registry Reuse**: Reuse registries instead of creating new ones frequently
|
|
407
|
-
3. **Statistical Monitoring**: Use the statistical baselines to detect anomalies
|
|
408
|
-
4. **Constraint Monitoring**: Regularly run memory tests to ensure constraints are met
|
|
409
|
-
|
|
410
|
-
## Troubleshooting
|
|
411
|
-
|
|
412
|
-
### Memory Issues
|
|
413
|
-
If memory tests fail, consider:
|
|
414
|
-
|
|
415
|
-
1. **Statistical Significance**: Check if failures are consistent across multiple iterations
|
|
416
|
-
2. **Variance Analysis**: High standard deviations may indicate unstable conditions
|
|
417
|
-
3. **Raw Data Review**: Examine individual measurements in data files for patterns
|
|
418
|
-
4. **System Resources**: Ensure adequate system memory is available during testing
|
|
419
|
-
|
|
420
|
-
### Constraint Violations
|
|
421
|
-
If memory constraints are exceeded:
|
|
422
|
-
|
|
423
|
-
1. **Statistical Confidence**: Verify violations are consistent across iterations
|
|
424
|
-
2. **Trend Analysis**: Use historical data to identify if this is a regression
|
|
425
|
-
3. **Outlier Investigation**: Check raw measurements for outliers affecting averages
|
|
426
|
-
4. **Update Thresholds**: Consider updating constraints based on statistical analysis
|
|
427
|
-
|
|
428
|
-
---
|
|
429
|
-
|
|
430
|
-
*This document is automatically generated during memory testing and includes statistical analysis of multiple iterations. Raw data files are saved for detailed analysis.*
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
# API Operations
|
|
2
|
-
|
|
3
|
-
This section provides comprehensive documentation for all available operations in the Fjell Client API. Each operation supports both Primary Items (PItemApi) and Contained Items (CItemApi) with location-aware variants.
|
|
4
|
-
|
|
5
|
-
## Quick Reference
|
|
6
|
-
|
|
7
|
-
### Core CRUD Operations
|
|
8
|
-
- **[`all`](./all.md)** - Retrieve multiple items with query support
|
|
9
|
-
- **[`create`](./create.md)** - Create new items with validation
|
|
10
|
-
- **[`get`](./get.md)** - Retrieve single items by key
|
|
11
|
-
- **[`update`](./update.md)** - Update existing items with partial data
|
|
12
|
-
- **[`remove`](./remove.md)** - Delete items safely
|
|
13
|
-
- **[`one`](./one.md)** - Find single item with query conditions
|
|
14
|
-
|
|
15
|
-
### Business Logic Operations
|
|
16
|
-
- **[`action`](./action.md)** - Execute business actions on items
|
|
17
|
-
- **[`allAction`](./allAction.md)** - Execute batch actions on collections
|
|
18
|
-
- **[`facet`](./facet.md)** - Retrieve analytics and computed data for items
|
|
19
|
-
- **[`allFacet`](./allFacet.md)** - Retrieve analytics for collections
|
|
20
|
-
|
|
21
|
-
### Query Operations
|
|
22
|
-
- **[`find`](./find.md)** - Find items using custom finders
|
|
23
|
-
- **[`findOne`](./findOne.md)** - Find single item using custom finders
|
|
24
|
-
|
|
25
|
-
## Operation Categories
|
|
26
|
-
|
|
27
|
-
### Primary Item Operations (PItemApi)
|
|
28
|
-
Operations for independent entities that exist at the top level of your API hierarchy:
|
|
29
|
-
|
|
30
|
-
```typescript
|
|
31
|
-
const userApi = createPItemApi<User, 'user'>('user', ['users'], config);
|
|
32
|
-
|
|
33
|
-
// Basic CRUD
|
|
34
|
-
const users = await userApi.all({ active: true });
|
|
35
|
-
const user = await userApi.create({ name: 'John', email: 'john@example.com' });
|
|
36
|
-
const foundUser = await userApi.get(userKey);
|
|
37
|
-
const updatedUser = await userApi.update(userKey, { name: 'John Smith' });
|
|
38
|
-
await userApi.remove(userKey);
|
|
39
|
-
|
|
40
|
-
// Business logic
|
|
41
|
-
await userApi.action(userKey, 'activate', { reason: 'manual' });
|
|
42
|
-
const analytics = await userApi.facet(userKey, 'activity-stats');
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Contained Item Operations (CItemApi)
|
|
46
|
-
Operations for hierarchical entities that require location context:
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
const taskApi = createCItemApi<Task, 'task', 'user'>('task', ['users', 'tasks'], config);
|
|
50
|
-
|
|
51
|
-
// Location-aware CRUD
|
|
52
|
-
const userTasks = await taskApi.all({ status: 'pending' }, [userId]);
|
|
53
|
-
const newTask = await taskApi.create({ title: 'Complete project' }, [userId]);
|
|
54
|
-
|
|
55
|
-
// Location-aware business logic
|
|
56
|
-
await taskApi.allAction('bulk-update', { priority: 'high' }, [userId]);
|
|
57
|
-
const taskMetrics = await taskApi.allFacet('completion-metrics', {}, [userId]);
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Error Handling
|
|
61
|
-
|
|
62
|
-
All operations include comprehensive error handling with:
|
|
63
|
-
- **Automatic retry logic** for transient failures
|
|
64
|
-
- **Custom error types** for different scenarios
|
|
65
|
-
- **Enhanced error context** for debugging
|
|
66
|
-
- **Configurable retry behavior**
|
|
67
|
-
|
|
68
|
-
See the [Error Handling Documentation](../error-handling/README.md) for complete details.
|
|
69
|
-
|
|
70
|
-
## Performance Considerations
|
|
71
|
-
|
|
72
|
-
### Pagination
|
|
73
|
-
Use `limit` and `offset` in queries for large datasets:
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
const users = await userApi.all({
|
|
77
|
-
limit: 50,
|
|
78
|
-
offset: 100,
|
|
79
|
-
sort: 'createdAt:desc'
|
|
80
|
-
});
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Batch Operations
|
|
84
|
-
Use `allAction` and `allFacet` for efficient batch processing:
|
|
85
|
-
|
|
86
|
-
```typescript
|
|
87
|
-
// Efficient batch update
|
|
88
|
-
await userApi.allAction('bulk-update', {
|
|
89
|
-
lastLoginAt: new Date()
|
|
90
|
-
}, { filter: 'active:true' });
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Caching Strategies
|
|
94
|
-
Implement client-side caching for frequently accessed data:
|
|
95
|
-
|
|
96
|
-
```typescript
|
|
97
|
-
const cachedUser = await cache.get(userKey) || await userApi.get(userKey);
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Type Safety
|
|
101
|
-
|
|
102
|
-
All operations are fully typed with TypeScript generics:
|
|
103
|
-
|
|
104
|
-
```typescript
|
|
105
|
-
interface User extends Item<'user'> {
|
|
106
|
-
name: string;
|
|
107
|
-
email: string;
|
|
108
|
-
active: boolean;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Type-safe operations
|
|
112
|
-
const userApi = createPItemApi<User, 'user'>('user', ['users'], config);
|
|
113
|
-
const user: User = await userApi.create({ name: 'John', email: 'john@example.com' });
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## Next Steps
|
|
117
|
-
|
|
118
|
-
- Review individual operation documentation for detailed examples
|
|
119
|
-
- Check the [Configuration Guide](../configuration.md) for setup options
|
|
120
|
-
- Explore [Error Handling](../error-handling/README.md) for resilience patterns
|
|
121
|
-
- See [Examples](../../examples-README.md) for complete usage scenarios
|