aifastdb 3.9.0 → 3.10.0

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.
Binary file
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * SocialGraphV2 API benchmark.
4
+ *
5
+ * Measures more realistic API-layer write performance for:
6
+ * - addPersonAsync (concurrent single-row writes)
7
+ * - addPersonsBatch (synchronous batch writes)
8
+ *
9
+ * Usage:
10
+ * node dist/social-graph-v2-benchmark.js
11
+ * node dist/social-graph-v2-benchmark.js --total=20000 --concurrency=64 --batch-size=500 --shards=16
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=social-graph-v2-benchmark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social-graph-v2-benchmark.d.ts","sourceRoot":"","sources":["../ts/social-graph-v2-benchmark.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG"}
@@ -0,0 +1,336 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * SocialGraphV2 API benchmark.
5
+ *
6
+ * Measures more realistic API-layer write performance for:
7
+ * - addPersonAsync (concurrent single-row writes)
8
+ * - addPersonsBatch (synchronous batch writes)
9
+ *
10
+ * Usage:
11
+ * node dist/social-graph-v2-benchmark.js
12
+ * node dist/social-graph-v2-benchmark.js --total=20000 --concurrency=64 --batch-size=500 --shards=16
13
+ */
14
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ var desc = Object.getOwnPropertyDescriptor(m, k);
17
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
+ desc = { enumerable: true, get: function() { return m[k]; } };
19
+ }
20
+ Object.defineProperty(o, k2, desc);
21
+ }) : (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ o[k2] = m[k];
24
+ }));
25
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
27
+ }) : function(o, v) {
28
+ o["default"] = v;
29
+ });
30
+ var __importStar = (this && this.__importStar) || (function () {
31
+ var ownKeys = function(o) {
32
+ ownKeys = Object.getOwnPropertyNames || function (o) {
33
+ var ar = [];
34
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
+ return ar;
36
+ };
37
+ return ownKeys(o);
38
+ };
39
+ return function (mod) {
40
+ if (mod && mod.__esModule) return mod;
41
+ var result = {};
42
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
+ __setModuleDefault(result, mod);
44
+ return result;
45
+ };
46
+ })();
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ const fs = __importStar(require("fs"));
49
+ const os = __importStar(require("os"));
50
+ const path = __importStar(require("path"));
51
+ const social_graph_v2_1 = require("./social-graph-v2");
52
+ function parseArgs() {
53
+ const cpuCount = os.cpus().length;
54
+ const defaults = {
55
+ total: 20000,
56
+ concurrency: Math.max(8, Math.min(cpuCount * 2, 128)),
57
+ batchSize: 500,
58
+ shardCount: Math.max(4, Math.min(cpuCount, 32)),
59
+ };
60
+ const args = new Map();
61
+ for (const rawArg of process.argv.slice(2)) {
62
+ if (!rawArg.startsWith('--'))
63
+ continue;
64
+ const [key, value] = rawArg.slice(2).split('=');
65
+ if (key && value)
66
+ args.set(key, value);
67
+ }
68
+ const readPositiveInt = (key) => {
69
+ const raw = args.get(key);
70
+ if (!raw)
71
+ return defaults[key];
72
+ const parsed = Number.parseInt(raw, 10);
73
+ if (!Number.isFinite(parsed) || parsed <= 0) {
74
+ throw new Error(`Invalid --${key} value: ${raw}`);
75
+ }
76
+ return parsed;
77
+ };
78
+ return {
79
+ total: readPositiveInt('total'),
80
+ concurrency: readPositiveInt('concurrency'),
81
+ batchSize: readPositiveInt('batchSize'),
82
+ shardCount: readPositiveInt('shardCount'),
83
+ };
84
+ }
85
+ function makeTempDir(prefix) {
86
+ return fs.mkdtempSync(path.join(os.tmpdir(), `${prefix}-`));
87
+ }
88
+ function cleanupDir(dir) {
89
+ try {
90
+ fs.rmSync(dir, { recursive: true, force: true });
91
+ }
92
+ catch {
93
+ // Best-effort cleanup for benchmark temp data.
94
+ }
95
+ }
96
+ function makePerson(index) {
97
+ return {
98
+ id: `person-${index}`,
99
+ name: `Person ${index}`,
100
+ description: `Benchmark person ${index} for SocialGraphV2 API throughput testing`,
101
+ email: `person${index}@benchmark.local`,
102
+ phone: `1380000${String(index % 10000).padStart(4, '0')}`,
103
+ properties: {
104
+ source: 'social-graph-v2-benchmark',
105
+ city: `city-${index % 50}`,
106
+ segment: `segment-${index % 20}`,
107
+ score: index % 100,
108
+ active: index % 2 === 0,
109
+ },
110
+ };
111
+ }
112
+ function printHeader(options) {
113
+ console.log('============================================================');
114
+ console.log(' SocialGraphV2 API Benchmark');
115
+ console.log('============================================================');
116
+ console.log(` Total persons: ${options.total.toLocaleString()}`);
117
+ console.log(` Async concurrency: ${options.concurrency.toLocaleString()}`);
118
+ console.log(` Batch size: ${options.batchSize.toLocaleString()}`);
119
+ console.log(` Shards: ${options.shardCount.toLocaleString()}`);
120
+ console.log(` CPU cores: ${os.cpus().length}`);
121
+ console.log(` Platform: ${process.platform} ${process.arch}`);
122
+ console.log('');
123
+ }
124
+ async function runConcurrentRange(total, concurrency, worker) {
125
+ let nextIndex = 0;
126
+ const workerCount = Math.min(concurrency, total);
127
+ await Promise.all(Array.from({ length: workerCount }, async () => {
128
+ while (true) {
129
+ const current = nextIndex;
130
+ nextIndex += 1;
131
+ if (current >= total)
132
+ break;
133
+ await worker(current);
134
+ }
135
+ }));
136
+ }
137
+ async function seedPersons(graph, total, concurrency) {
138
+ await runConcurrentRange(total, concurrency, async (index) => {
139
+ await graph.addPersonAsync(makePerson(index));
140
+ });
141
+ graph.flush();
142
+ graph.save();
143
+ }
144
+ function makeFriendPair(index) {
145
+ return {
146
+ personA: `person-${index}`,
147
+ personB: `person-${index + 1}`,
148
+ config: {
149
+ relationType: 'friend',
150
+ weight: 0.5 + ((index % 5) * 0.1),
151
+ bidirectional: false,
152
+ metadata: {
153
+ source: 'social-graph-v2-benchmark',
154
+ lane: `lane-${index % 8}`,
155
+ },
156
+ },
157
+ };
158
+ }
159
+ function printResult(result) {
160
+ const numberOrNA = (value, digits = 2) => {
161
+ if (typeof value !== 'number' || !Number.isFinite(value))
162
+ return 'N/A';
163
+ return value.toFixed(digits);
164
+ };
165
+ const intOrNA = (value) => {
166
+ if (typeof value !== 'number' || !Number.isFinite(value))
167
+ return 'N/A';
168
+ return Math.round(value).toLocaleString();
169
+ };
170
+ console.log(`\n=== ${result.scenario} ===`);
171
+ console.log(`Total ${result.unit}: ${result.total.toLocaleString()}`);
172
+ console.log(`Elapsed: ${result.elapsedMs.toFixed(2)} ms`);
173
+ console.log(`Throughput: ${Math.round(result.throughput).toLocaleString()} ${result.unit}/sec`);
174
+ console.log(`Avg cost: ${result.avgMsPerItem.toFixed(3)} ms/${result.unit === 'persons' ? 'person' : 'relation'}`);
175
+ console.log(`Entity count: ${result.entityCount.toLocaleString()}`);
176
+ console.log(`Relation count: ${result.relationCount.toLocaleString()}`);
177
+ console.log(`Metrics: writes=${intOrNA(result.metrics.successfulWrites)}, failed=${intOrNA(result.metrics.failedWrites)}, rejected=${intOrNA(result.metrics.rejectedRequests)}, avgWrite=${numberOrNA(typeof result.metrics.avgWriteTimeUs === 'number' ? result.metrics.avgWriteTimeUs / 1000 : undefined)}ms, avgQueue=${numberOrNA(typeof result.metrics.avgQueueTimeUs === 'number' ? result.metrics.avgQueueTimeUs / 1000 : undefined)}ms, queueFill=${numberOrNA(typeof result.metrics.queueFillRatio === 'number' ? result.metrics.queueFillRatio * 100 : undefined)}%`);
178
+ }
179
+ async function benchmarkAddPersonAsync(options) {
180
+ const dbPath = makeTempDir('sgv2-api-async');
181
+ const graph = social_graph_v2_1.SocialGraphV2.highThroughput(dbPath, options.shardCount);
182
+ try {
183
+ const workerCount = Math.min(options.concurrency, options.total);
184
+ const start = performance.now();
185
+ await runConcurrentRange(options.total, workerCount, async (index) => {
186
+ await graph.addPersonAsync(makePerson(index));
187
+ });
188
+ graph.flush();
189
+ graph.save();
190
+ const elapsedMs = performance.now() - start;
191
+ return {
192
+ scenario: `addPersonAsync (concurrency=${workerCount})`,
193
+ total: options.total,
194
+ elapsedMs,
195
+ throughput: options.total / (elapsedMs / 1000),
196
+ avgMsPerItem: elapsedMs / options.total,
197
+ unit: 'persons',
198
+ entityCount: graph.getEntityCount(),
199
+ relationCount: graph.getRelationCount(),
200
+ metrics: graph.getMetrics(),
201
+ };
202
+ }
203
+ finally {
204
+ graph.shutdown();
205
+ cleanupDir(dbPath);
206
+ }
207
+ }
208
+ async function benchmarkAddPersonsBatch(options) {
209
+ const dbPath = makeTempDir('sgv2-api-batch');
210
+ const graph = social_graph_v2_1.SocialGraphV2.highThroughput(dbPath, options.shardCount);
211
+ try {
212
+ const start = performance.now();
213
+ for (let batchStart = 0; batchStart < options.total; batchStart += options.batchSize) {
214
+ const batchEnd = Math.min(batchStart + options.batchSize, options.total);
215
+ const batch = [];
216
+ for (let i = batchStart; i < batchEnd; i++) {
217
+ batch.push(makePerson(i));
218
+ }
219
+ graph.addPersonsBatch(batch);
220
+ }
221
+ graph.flush();
222
+ graph.save();
223
+ const elapsedMs = performance.now() - start;
224
+ return {
225
+ scenario: `addPersonsBatch (batchSize=${options.batchSize})`,
226
+ total: options.total,
227
+ elapsedMs,
228
+ throughput: options.total / (elapsedMs / 1000),
229
+ avgMsPerItem: elapsedMs / options.total,
230
+ unit: 'persons',
231
+ entityCount: graph.getEntityCount(),
232
+ relationCount: graph.getRelationCount(),
233
+ metrics: graph.getMetrics(),
234
+ };
235
+ }
236
+ finally {
237
+ graph.shutdown();
238
+ cleanupDir(dbPath);
239
+ }
240
+ }
241
+ async function benchmarkAddFriendAsync(options) {
242
+ const dbPath = makeTempDir('sgv2-api-friend-async');
243
+ const graph = social_graph_v2_1.SocialGraphV2.highThroughput(dbPath, options.shardCount);
244
+ try {
245
+ await seedPersons(graph, options.total + 1, options.concurrency);
246
+ const workerCount = Math.min(options.concurrency, options.total);
247
+ const start = performance.now();
248
+ await runConcurrentRange(options.total, workerCount, async (index) => {
249
+ const pair = makeFriendPair(index);
250
+ await graph.addFriendAsync(pair.personA, pair.personB, pair.config);
251
+ });
252
+ graph.flush();
253
+ graph.save();
254
+ const elapsedMs = performance.now() - start;
255
+ return {
256
+ scenario: `addFriendAsync (concurrency=${workerCount})`,
257
+ total: options.total,
258
+ elapsedMs,
259
+ throughput: options.total / (elapsedMs / 1000),
260
+ avgMsPerItem: elapsedMs / options.total,
261
+ unit: 'relations',
262
+ entityCount: graph.getEntityCount(),
263
+ relationCount: graph.getRelationCount(),
264
+ metrics: graph.getMetrics(),
265
+ };
266
+ }
267
+ finally {
268
+ graph.shutdown();
269
+ cleanupDir(dbPath);
270
+ }
271
+ }
272
+ async function benchmarkAddFriendsBatch(options) {
273
+ const dbPath = makeTempDir('sgv2-api-friend-batch');
274
+ const graph = social_graph_v2_1.SocialGraphV2.highThroughput(dbPath, options.shardCount);
275
+ try {
276
+ await seedPersons(graph, options.total + 1, options.concurrency);
277
+ const start = performance.now();
278
+ for (let batchStart = 0; batchStart < options.total; batchStart += options.batchSize) {
279
+ const batchEnd = Math.min(batchStart + options.batchSize, options.total);
280
+ const batch = [];
281
+ for (let i = batchStart; i < batchEnd; i++) {
282
+ batch.push(makeFriendPair(i));
283
+ }
284
+ graph.addFriendsBatch(batch);
285
+ }
286
+ graph.flush();
287
+ graph.save();
288
+ const elapsedMs = performance.now() - start;
289
+ return {
290
+ scenario: `addFriendsBatch (batchSize=${options.batchSize})`,
291
+ total: options.total,
292
+ elapsedMs,
293
+ throughput: options.total / (elapsedMs / 1000),
294
+ avgMsPerItem: elapsedMs / options.total,
295
+ unit: 'relations',
296
+ entityCount: graph.getEntityCount(),
297
+ relationCount: graph.getRelationCount(),
298
+ metrics: graph.getMetrics(),
299
+ };
300
+ }
301
+ finally {
302
+ graph.shutdown();
303
+ cleanupDir(dbPath);
304
+ }
305
+ }
306
+ function printSummary(personAsyncResult, personBatchResult, friendAsyncResult, friendBatchResult) {
307
+ const personSpeedup = personBatchResult.throughput / Math.max(personAsyncResult.throughput, 1);
308
+ const relationSpeedup = friendBatchResult.throughput / Math.max(friendAsyncResult.throughput, 1);
309
+ console.log('\n============================================================');
310
+ console.log(' Summary');
311
+ console.log('============================================================');
312
+ console.log(` addPersonAsync: ${Math.round(personAsyncResult.throughput).toLocaleString()} persons/sec (${personAsyncResult.avgMsPerItem.toFixed(3)} ms/person)`);
313
+ console.log(` addPersonsBatch: ${Math.round(personBatchResult.throughput).toLocaleString()} persons/sec (${personBatchResult.avgMsPerItem.toFixed(3)} ms/person)`);
314
+ console.log(` Person batch vs async throughput: ${personSpeedup.toFixed(2)}x`);
315
+ console.log(` addFriendAsync: ${Math.round(friendAsyncResult.throughput).toLocaleString()} relations/sec (${friendAsyncResult.avgMsPerItem.toFixed(3)} ms/relation)`);
316
+ console.log(` addFriendsBatch: ${Math.round(friendBatchResult.throughput).toLocaleString()} relations/sec (${friendBatchResult.avgMsPerItem.toFixed(3)} ms/relation)`);
317
+ console.log(` Relation batch vs async throughput: ${relationSpeedup.toFixed(2)}x`);
318
+ }
319
+ async function main() {
320
+ const options = parseArgs();
321
+ printHeader(options);
322
+ const asyncResult = await benchmarkAddPersonAsync(options);
323
+ printResult(asyncResult);
324
+ const batchResult = await benchmarkAddPersonsBatch(options);
325
+ printResult(batchResult);
326
+ const friendAsyncResult = await benchmarkAddFriendAsync(options);
327
+ printResult(friendAsyncResult);
328
+ const friendBatchResult = await benchmarkAddFriendsBatch(options);
329
+ printResult(friendBatchResult);
330
+ printSummary(asyncResult, batchResult, friendAsyncResult, friendBatchResult);
331
+ }
332
+ main().catch((error) => {
333
+ console.error('Benchmark failed:', error);
334
+ process.exit(1);
335
+ });
336
+ //# source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