signalk-questdb 2.1.2 → 2.1.3
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/README.md +1 -1
- package/dist/container-env.js +68 -2
- package/dist/container-env.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -417,7 +417,7 @@ The plugin is optimized for Raspberry Pi and similar low-power devices:
|
|
|
417
417
|
|
|
418
418
|
- **Default sampling rate** of 2000ms limits each path to 1 write per 2 seconds, keeping write volume modest on busy NMEA 2000 buses
|
|
419
419
|
- **Resource caps** of 768 MB RAM and 1.5 CPU cores (cgroup limits via signalk-container) keep QuestDB from squeezing co-resident containers like Grafana, mayara, or signalk-backup. The JVM auto-sizes its heap to a fraction of the memory cap, so total footprint (heap + off-heap) is bounded
|
|
420
|
-
- **QuestDB worker
|
|
420
|
+
- **QuestDB worker tuning** cuts idle CPU on low-power hosts. QuestDB sizes its worker pools from the host core count and busy-polls before sleeping — sensible on a server, wasteful on a mostly idle boat database, where threads burn CPU waiting for work that never arrives. The plugin pins its worker pools down and quiets QuestDB's per-commit logging, keeping the messages that matter. One caveat worth knowing when upgrading the QuestDB image: an unrecognised setting is ignored silently, so a property renamed between releases looks exactly like one that worked
|
|
421
421
|
- **ILP batching** commits every 5s (configurable via "Write batch interval"; a large backlog of buffered rows commits early). Each commit is one WAL transaction per table, and with deduplicated tables the apply cost of a transaction grows with partition size — frequent tiny commits eventually outpace what a Pi can apply and recording stalls. Bigger batches keep the WAL healthy; the cost is that at most one interval of buffered samples is lost on a hard crash
|
|
422
422
|
- Per-path overrides allow faster rates for critical paths (e.g. `{ "environment.wind.*": 200 }`) while keeping slow-changing paths throttled
|
|
423
423
|
- Set the memory limit to empty or CPU limit to `0` to disable the cap entirely on roomier hosts
|
package/dist/container-env.js
CHANGED
|
@@ -21,16 +21,82 @@
|
|
|
21
21
|
// handful of fsyncs per commit interval (ILP batches at `ilpFlushIntervalMs`,
|
|
22
22
|
// 5s by default), which at boat data rates is noise against losing a table.
|
|
23
23
|
export const QUESTDB_COMMIT_MODE = "sync";
|
|
24
|
+
// Poll cycles a worker spins before sleeping. QuestDB's default is 10000,
|
|
25
|
+
// which keeps threads hot on a database that is idle most of the time. Low
|
|
26
|
+
// enough to sleep promptly, high enough that a burst of ingest does not pay a
|
|
27
|
+
// wake-up per batch.
|
|
28
|
+
const WORKER_SLEEP_THRESHOLD = "100";
|
|
24
29
|
export function buildContainerEnv(config) {
|
|
25
30
|
return {
|
|
26
31
|
QDB_TELEMETRY_ENABLED: "false",
|
|
27
32
|
QDB_HTTP_ENABLED: "true",
|
|
28
33
|
QDB_LINE_TCP_ENABLED: "true",
|
|
29
34
|
QDB_CAIRO_COMMIT_MODE: QUESTDB_COMMIT_MODE,
|
|
30
|
-
//
|
|
31
|
-
|
|
35
|
+
// ── Low-power tuning (Pi, Cerbo) ──────────────────────────────────────
|
|
36
|
+
//
|
|
37
|
+
// QuestDB sizes most worker pools from the host core count and defaults
|
|
38
|
+
// each pool to a busy-poll before it sleeps. That is right for a server
|
|
39
|
+
// and wrong for a boat: on a mostly idle database the threads burn CPU
|
|
40
|
+
// waiting for work that never comes, and the cost is a fixed floor rather
|
|
41
|
+
// than something that scales with the data.
|
|
42
|
+
//
|
|
43
|
+
// NOTE ON NAMING: QuestDB ignores an unrecognised QDB_* variable in
|
|
44
|
+
// silence — no warning, no startup failure — so a wrong name is
|
|
45
|
+
// indistinguishable from a setting that worked. Verify any change here
|
|
46
|
+
// against the running server rather than against the docs:
|
|
47
|
+
//
|
|
48
|
+
// SELECT property_path, value, value_source FROM (SHOW PARAMETERS)
|
|
49
|
+
// WHERE value_source = 'env'
|
|
50
|
+
//
|
|
51
|
+
// A key that reports `default` there was not applied, whatever was
|
|
52
|
+
// passed. (The startup log names each pool's `workers=N` too, but
|
|
53
|
+
// QDB_LOG_W_STDOUT_LEVEL below suppresses those lines, so the query is
|
|
54
|
+
// the reliable check.)
|
|
55
|
+
//
|
|
56
|
+
// `wal.apply.worker.count` has NO `cairo.` prefix, unlike its neighbours
|
|
57
|
+
// `cairo.wal.apply.*` — the one spelling in this block most likely to be
|
|
58
|
+
// guessed wrong.
|
|
59
|
+
QDB_WAL_APPLY_WORKER_COUNT: "1",
|
|
32
60
|
QDB_SHARED_WORKER_COUNT: "1",
|
|
33
61
|
QDB_LINE_TCP_WRITER_WORKER_COUNT: "1",
|
|
62
|
+
// Zero is this pool's default and does NOT mean "share the common pool"
|
|
63
|
+
// the way it does elsewhere — ILP keys per-worker state by worker id, so
|
|
64
|
+
// it gets a dedicated pool sized 2 regardless of the core count. Leaving
|
|
65
|
+
// it unset was our own gap: the writer pool was pinned to 1 while the io
|
|
66
|
+
// pool beside it still ran two threads.
|
|
67
|
+
QDB_LINE_TCP_IO_WORKER_COUNT: "1",
|
|
68
|
+
// Pools for features this plugin never uses. They are sized and polled
|
|
69
|
+
// regardless, which makes them precisely the ones nobody thinks to set.
|
|
70
|
+
QDB_VIEW_COMPILER_WORKER_COUNT: "1",
|
|
71
|
+
QDB_MAT_VIEW_REFRESH_WORKER_COUNT: "1",
|
|
72
|
+
QDB_LIVE_VIEW_REFRESH_WORKER_COUNT: "1",
|
|
73
|
+
QDB_EXPORT_WORKER_COUNT: "1",
|
|
74
|
+
// Poll cycles a worker spins before sleeping. There is no global default,
|
|
75
|
+
// so every pool needs its own — one left out keeps the full spin.
|
|
76
|
+
QDB_SHARED_WORKER_SLEEP_THRESHOLD: WORKER_SLEEP_THRESHOLD,
|
|
77
|
+
// The HTTP and pg-wire pools take their own threshold even though both
|
|
78
|
+
// currently draw workers from `shared-network` — QuestDB reports them at
|
|
79
|
+
// the 10000 default there rather than inheriting the shared value. Set
|
|
80
|
+
// one of the two `*.worker.count` keys and each becomes a dedicated pool
|
|
81
|
+
// where its own threshold is what governs, so leaving these unset is a
|
|
82
|
+
// gap that only opens when a default changes.
|
|
83
|
+
QDB_HTTP_WORKER_SLEEP_THRESHOLD: WORKER_SLEEP_THRESHOLD,
|
|
84
|
+
QDB_PG_WORKER_SLEEP_THRESHOLD: WORKER_SLEEP_THRESHOLD,
|
|
85
|
+
QDB_WAL_APPLY_WORKER_SLEEP_THRESHOLD: WORKER_SLEEP_THRESHOLD,
|
|
86
|
+
QDB_LINE_TCP_IO_WORKER_SLEEP_THRESHOLD: WORKER_SLEEP_THRESHOLD,
|
|
87
|
+
QDB_LINE_TCP_WRITER_WORKER_SLEEP_THRESHOLD: WORKER_SLEEP_THRESHOLD,
|
|
88
|
+
QDB_VIEW_COMPILER_WORKER_SLEEP_THRESHOLD: WORKER_SLEEP_THRESHOLD,
|
|
89
|
+
QDB_MAT_VIEW_REFRESH_WORKER_SLEEP_THRESHOLD: WORKER_SLEEP_THRESHOLD,
|
|
90
|
+
QDB_LIVE_VIEW_REFRESH_WORKER_SLEEP_THRESHOLD: WORKER_SLEEP_THRESHOLD,
|
|
91
|
+
QDB_EXPORT_WORKER_SLEEP_THRESHOLD: WORKER_SLEEP_THRESHOLD,
|
|
92
|
+
// QuestDB narrates every WAL commit at INFO — several lines a second of
|
|
93
|
+
// pure noise, written to the container log forever. ERROR is a floor, not
|
|
94
|
+
// an exact set, so CRITICAL and ADVISORY still come through: table
|
|
95
|
+
// suspension, ILP parse failures and the max_map_count warning all
|
|
96
|
+
// survive. What it drops is the INFO band — which also carries the WAL
|
|
97
|
+
// apply memory-pressure backoff that precedes a suspension, so raise this
|
|
98
|
+
// back to INFO when diagnosing a database that has stopped recording.
|
|
99
|
+
QDB_LOG_W_STDOUT_LEVEL: "ERROR",
|
|
34
100
|
QDB_CAIRO_O3_COLUMN_MEMORY_SIZE: "262144",
|
|
35
101
|
...(config.compression && config.compression !== "none"
|
|
36
102
|
? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container-env.js","sourceRoot":"","sources":["../src/container-env.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,wEAAwE;AACxE,8EAA8E;AAC9E,6EAA6E;AAC7E,0EAA0E;A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