mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
feat(base): env var for duckdb reader-pool size
This commit is contained in:
@@ -10,6 +10,7 @@ export type QueryCacheConfig = {
|
||||
threads: number;
|
||||
trace: boolean;
|
||||
tempDirectory: string;
|
||||
readerPoolSize: number;
|
||||
};
|
||||
|
||||
@Injectable()
|
||||
@@ -25,6 +26,7 @@ export class QueryCacheConfigProvider {
|
||||
threads: env.getBaseQueryCacheThreads(),
|
||||
trace: env.getBaseQueryCacheTrace(),
|
||||
tempDirectory: env.getBaseQueryCacheTempDirectory(),
|
||||
readerPoolSize: env.getBaseQueryCacheReaderPoolSize(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,4 +385,20 @@ export class EnvironmentService {
|
||||
10,
|
||||
);
|
||||
}
|
||||
|
||||
getBaseQueryCacheReaderPoolSize(): number {
|
||||
// Number of reader connections held open against the shared DuckDB
|
||||
// instance. Reads are dispatched via `withReader()` which checks out a
|
||||
// connection, runs the query, returns it. Bigger pool = more concurrent
|
||||
// reads without serialization, at the cost of per-connection overhead
|
||||
// (each connection carries its own catalog snapshot + prepared-statement
|
||||
// cache ~= 300 KB).
|
||||
//
|
||||
// Default 4 matches libuv's default thread-pool size. Raise to 8+ if
|
||||
// you see p99 list latency correlate with concurrent request volume.
|
||||
return parseInt(
|
||||
this.configService.get<string>('BASE_QUERY_CACHE_READER_POOL_SIZE', '4'),
|
||||
10,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user