@mistriwork/engine 1.0.0-rc.70 → 1.0.0-rc.72
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.
|
@@ -91,8 +91,13 @@ export interface PgConnectionOptions {
|
|
|
91
91
|
/** Only readers are ever opened here (a tenant App's replica): the budget counts them and no writer. */
|
|
92
92
|
readonly readersOnly?: boolean;
|
|
93
93
|
}
|
|
94
|
+
/** The fewest readers an App's pool holds where none was chosen, whatever the cores. A page's reads leave at once,
|
|
95
|
+
* each on a reader of its own where they do not share a snapshot, and on a database a round trip away a page that
|
|
96
|
+
* waited for one of four readers paid its round trips in turns (a profile: one or two cores, 30 ms away). Readers
|
|
97
|
+
* are opened as they are asked and all but WARM_READERS let go idle, so the floor costs connections only under load. */
|
|
98
|
+
export declare const APP_READER_FLOOR = 10;
|
|
94
99
|
/** An App's reader pool where none was chosen: as wide as its writers, at least the balanced size for `cores`
|
|
95
|
-
* (this machine's, unless a deployment check asks for another's). */
|
|
100
|
+
* (this machine's, unless a deployment check asks for another's) and APP_READER_FLOOR. */
|
|
96
101
|
export declare function appReaders(writers: number, cores?: number): number;
|
|
97
102
|
/**
|
|
98
103
|
* The defaults every manager in this process takes when it names none: the
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* from the command line:
|
|
8
8
|
*
|
|
9
9
|
* - How many readers the pool may hold: for an App as many as its writers
|
|
10
|
-
* (at least balancedPoolSize), four for the
|
|
11
|
-
* otherwise; one to sixty-four.
|
|
10
|
+
* (at least balancedPoolSize and APP_READER_FLOOR, ten), four for the
|
|
11
|
+
* database browser, unless told otherwise; one to sixty-four.
|
|
12
12
|
* - How many writers: balancedPoolSize for a process serving Apps unless told otherwise
|
|
13
13
|
* (`pool.write`, `--write-pool`; writeLanes.ts), one to sixty-four, each running one
|
|
14
14
|
* transaction beside the others (writeLanes.ts orders writes of one
|
|
@@ -65,10 +65,17 @@ const loadPg = async () => {
|
|
|
65
65
|
* An App's is balanced against its writers (appReaders). */
|
|
66
66
|
export const DEFAULT_READERS = 4;
|
|
67
67
|
/** Readers kept connected through an idle spell. Without them the first read
|
|
68
|
-
* after
|
|
68
|
+
* after a quiet spell paid a new connection and its two SETs — and a
|
|
69
69
|
* dashboard's fan-out paid it several times at once. Two, not the whole pool:
|
|
70
70
|
* a warm connection is a server backend held for nothing most of the day. */
|
|
71
71
|
const WARM_READERS = 2;
|
|
72
|
+
/** Writers kept connected through an idle spell: one, for the same reason, so the first command after a quiet
|
|
73
|
+
* spell does not reconnect (a field report: about 230 ms on a hosted database). One is enough: a burst of commands
|
|
74
|
+
* opens the rest as it asks, and a backend held warm per writer would cost most when the pool is widest. */
|
|
75
|
+
const WARM_WRITERS = 1;
|
|
76
|
+
/** How long an idle connection stays open: five minutes, past a lunch-hour lull but well inside what a
|
|
77
|
+
* hosted database or its pooler lets a connection sit. The extra ones (beyond the warm minimum) close then. */
|
|
78
|
+
const IDLE_TIMEOUT_MS = 300_000;
|
|
72
79
|
/** The most readers one database's pool may hold. Past this, a pooler in front of the server is the tool. */
|
|
73
80
|
export const MAX_READERS = 64;
|
|
74
81
|
/** What pg-pool says when no connection came free within the acquisition timeout. */
|
|
@@ -91,10 +98,15 @@ let timing;
|
|
|
91
98
|
function defaultReaders(writers) {
|
|
92
99
|
return writeOrder() === 'keyed' ? appReaders(writers) : DEFAULT_READERS;
|
|
93
100
|
}
|
|
101
|
+
/** The fewest readers an App's pool holds where none was chosen, whatever the cores. A page's reads leave at once,
|
|
102
|
+
* each on a reader of its own where they do not share a snapshot, and on a database a round trip away a page that
|
|
103
|
+
* waited for one of four readers paid its round trips in turns (a profile: one or two cores, 30 ms away). Readers
|
|
104
|
+
* are opened as they are asked and all but WARM_READERS let go idle, so the floor costs connections only under load. */
|
|
105
|
+
export const APP_READER_FLOOR = 10;
|
|
94
106
|
/** An App's reader pool where none was chosen: as wide as its writers, at least the balanced size for `cores`
|
|
95
|
-
* (this machine's, unless a deployment check asks for another's). */
|
|
107
|
+
* (this machine's, unless a deployment check asks for another's) and APP_READER_FLOOR. */
|
|
96
108
|
export function appReaders(writers, cores) {
|
|
97
|
-
return Math.min(MAX_READERS, Math.max(balancedPoolSize(cores), writers));
|
|
109
|
+
return Math.min(MAX_READERS, Math.max(APP_READER_FLOOR, balancedPoolSize(cores), writers));
|
|
98
110
|
}
|
|
99
111
|
/**
|
|
100
112
|
* The defaults every manager in this process takes when it names none: the
|
|
@@ -345,16 +357,14 @@ export class PgConnectionManager {
|
|
|
345
357
|
...this.dialOptions(),
|
|
346
358
|
max: this.meters[role].size,
|
|
347
359
|
connectionTimeoutMillis: 10_000,
|
|
348
|
-
idleTimeoutMillis:
|
|
349
|
-
/* Readers
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
allowExitOnIdle: true,
|
|
357
|
-
}),
|
|
360
|
+
idleTimeoutMillis: IDLE_TIMEOUT_MS,
|
|
361
|
+
/* Readers and the foreground writers keep a few connections warm
|
|
362
|
+
(the background writer, which runs jobs that are not waited on, keeps none). The
|
|
363
|
+
idle ones never keep the process alive by themselves, so a one-shot
|
|
364
|
+
mode that forgets to close still exits: that is why the writer
|
|
365
|
+
sets this too, now that it holds a connection through idle. */
|
|
366
|
+
allowExitOnIdle: true,
|
|
367
|
+
...(role === 'background' ? {} : { min: Math.min(role === 'read' ? WARM_READERS : WARM_WRITERS, this.meters[role].size) }),
|
|
358
368
|
/* A writer sends each statement as it is asked, not after the one
|
|
359
369
|
before it is answered: a transaction that asks several at once
|
|
360
370
|
(pipelined, postgresTransactionHandle.ts) pays one round trip for
|
|
@@ -13,6 +13,7 @@ export declare const FRAMEWORK_WORDS: {
|
|
|
13
13
|
readonly 'mistri.form.step': 'Step {step} of {count}';
|
|
14
14
|
readonly 'mistri.form.stepNamed': 'Step {step} of {count}: {label}';
|
|
15
15
|
readonly 'mistri.form.back': 'Back';
|
|
16
|
+
readonly 'mistri.form.continue': 'Continue';
|
|
16
17
|
readonly 'mistri.form.optional': '(optional)';
|
|
17
18
|
readonly 'mistri.form.required': '(required)';
|
|
18
19
|
readonly 'mistri.form.reference': 'Your reference';
|
|
@@ -13,6 +13,7 @@ export const FRAMEWORK_WORDS = {
|
|
|
13
13
|
'mistri.form.step': 'Step {step} of {count}',
|
|
14
14
|
'mistri.form.stepNamed': 'Step {step} of {count}: {label}',
|
|
15
15
|
'mistri.form.back': 'Back',
|
|
16
|
+
'mistri.form.continue': 'Continue',
|
|
16
17
|
'mistri.form.optional': '(optional)',
|
|
17
18
|
'mistri.form.required': '(required)',
|
|
18
19
|
'mistri.form.reference': 'Your reference',
|
|
@@ -2,6 +2,7 @@ export const FRAMEWORK_WORDS_ES = Object.freeze({
|
|
|
2
2
|
'mistri.form.step': 'Paso {step} de {count}',
|
|
3
3
|
'mistri.form.stepNamed': 'Paso {step} de {count}: {label}',
|
|
4
4
|
'mistri.form.back': 'Atrás',
|
|
5
|
+
'mistri.form.continue': 'Continuar',
|
|
5
6
|
'mistri.form.optional': '(opcional)',
|
|
6
7
|
'mistri.form.required': '(obligatorio)',
|
|
7
8
|
'mistri.form.reference': 'Tu referencia',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mistriwork/engine",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.72",
|
|
4
4
|
"description": "The engine both products stand on: the adapters (SQLite, Postgres), the catalog, the query language, keyset pages, the HTTP kit and the shared rules. No React.",
|
|
5
5
|
"homepage": "https://mistriwork.dev",
|
|
6
6
|
"bugs": {
|