-
Notifications
You must be signed in to change notification settings - Fork 37
Update config pages for 4.3.1.4 #635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -411,9 +411,9 @@ import Banner from '~/components/Banner.astro'; | |
| </div> | ||
| </div> | ||
|
|
||
| ## Database telemetry parameters | ||
| ## Database parameters | ||
|
|
||
| <Banner variant="pe">Selects the storage backend (SQL, Cassandra, or TimescaleDB) for time-series and latest telemetry data, and sets the maximum query intervals.</Banner> | ||
| <Banner variant="pe">Selects the storage backend (SQL, Cassandra, or TimescaleDB) for time-series and latest telemetry data and the maximum query intervals,<br /> and configures optional Citus (distributed PostgreSQL) support.</Banner> | ||
|
|
||
| <div class="config-def-list"> | ||
| <div class="config-def-item"> | ||
|
|
@@ -428,6 +428,42 @@ import Banner from '~/components/Banner.astro'; | |
| <p class="config-def-meta"><code class="config-def-env">DATABASE_TS_LATEST_TYPE</code> · <span class="config-def-label">Default</span> <code>sql</code></p> | ||
| <p class="config-def-desc">cassandra, sql, or timescale (for hybrid mode, DATABASE_TS_TYPE value should be cassandra, or timescale)</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">DATABASE_CITUS_ENABLED</code> · <span class="config-def-label">Default</span> <code>false</code></p> | ||
| <p class="config-def-desc">Enable optional Citus (distributed PostgreSQL) support. PE only. Default: plain PostgreSQL. This is far more than distributing attribute_kv and ts_kv_latest: enabling it hash-distributes device, asset, entity_view (by id) and alarm, entity_alarm (by originator_id), rewrites the alarm-group primary keys to include the distribution column, drops the unique constraints that are incompatible with the chosen distribution, and converts ~25 dimension tables (relation, key_dictionary, device/asset profiles, etc.) into replicated reference tables. See CitusTables for the authoritative list of distributed/reference tables. Because the distribution is applied to live schema, this is effectively a one-way switch: plan to (re)create the database with Citus in mind.</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">DATABASE_CITUS_SHARD_COUNT</code> · <span class="config-def-label">Default</span> <code>32</code></p> | ||
| <p class="config-def-desc">Number of Citus shards for the hash-distributed tables. Fixed at distribution time; size >= max expected worker count, ideally a multiple of it. CONNECTION POOL SIZING: with Citus enabled, the attribute_kv and ts_kv_latest write queues each use shard_count writer threads (one queue per shard, so each batch targets a single shard) INSTEAD OF sql.attributes.batch_threads / sql.ts_latest.batch_threads. That is 2 * shard_count KV-writer threads in total, each borrowing a coordinator JDBC connection while draining its batch (one shard per batch => one worker connection per flush). The default spring.datasource.hikari.maximumPoolSize of 16 is undersized for Citus and will stall writes: raise it via SPRING_DATASOURCE_MAXIMUM_POOL_SIZE. At peak all 2 * shard_count writer threads can flush at once, so to guarantee writers never wait, size maximumPoolSize >= 2 * shard_count + headroom for the rest of the app (entity DAO, rule engine, REST, EDQS) — e.g. ~64 + ~16 = ~80 for shard_count=32. Each thread holds a connection only briefly while flushing its batch, so a smaller pool often suffices in practice; tune it down/up by watching the HikariCP pending-connection count under peak ingestion. Also ensure the Citus workers' connection limits accommodate maximumPoolSize * worker_count. Note that each of the two KV queues spawns exactly one flush thread per shard bucket, so both writer-thread count and peak connection demand scale as 2 * shard_count per app instance. Raising shard_count for finer rebalance granularity therefore also multiplies KV writer threads and their connection footprint; a bounded flush pool decoupling thread count from shard_count is a possible future optimization. When smart_routing.enabled=true (the default when Citus is on), the KV read+write path shifts OFF the coordinator pool onto the per-worker pools (smart_routing.worker_pool_size), so the coordinator maximumPoolSize pressure from the KV path is correspondingly reduced — but each worker now needs its own pool sized for the shards it owns (see the worker_pool_size comment below).</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">DATABASE_CITUS_SMART_ROUTING_ENABLED</code> · <span class="config-def-label">Default</span> <code>${DATABASE_CITUS_ENABLED:false}</code></p> | ||
| <p class="config-def-desc">Connect directly to the Citus worker owning a shard for single-shard KV ops instead of routing via the coordinator. Defaults to database.citus.enabled.</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">DATABASE_CITUS_SMART_ROUTING_WORKER_HOST_OVERRIDES</code></p> | ||
| <p class="config-def-desc">Optional comma-separated nodename=host:port overrides for worker reachability (e.g. docker/NAT). Empty => use addresses reported by Citus.</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">DATABASE_CITUS_SMART_ROUTING_WORKER_POOL_SIZE</code> · <span class="config-def-label">Default</span> <code>8</code></p> | ||
| <p class="config-def-desc">Per-worker Hikari pool size for direct worker connections. Small pools for short single-shard ops. SIZING: a single worker owns roughly shard_count / worker_count shards, and up to that many per-shard write-queue threads can flush to that one worker concurrently. If worker_pool_size is smaller, concurrent flushes wait up to worker_connection_timeout_ms and, on timeout, the routed flush FAILS (no fallback). Size worker_pool_size >= ceil(shard_count / min_expected_worker_count) plus headroom for the single-entity routed reads. Tradeoff: total worker connection budget is worker_pool_size * worker_count * app_instances connections landing on each worker's max_connections, so do not oversize. Default 8 suits shard_count=32 with >=6 workers; raise it for fewer/heavier-loaded workers. READ SIZING: single-entity routed reads (rule-engine attribute/latest lookups) share this same per-worker pool with up to 2 * shard_count / worker_count concurrent write flushes for that worker. A read that cannot borrow within worker_connection_timeout_ms FAILS outright (there is no coordinator fallback for a routed read), so size the pool for read bursts riding on top of the flush bursts.</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">DATABASE_CITUS_SMART_ROUTING_PLACEMENT_REFRESH_INTERVAL_MS</code> · <span class="config-def-label">Default</span> <code>300000</code></p> | ||
| <p class="config-def-desc">How often (ms) to refresh shard placements (bucket->worker). Placements move on rebalance; a stale placement is correctness-safe (Citus MX forwards to the true owner). The same cadence also drives worker-pool reconciliation: adding pools for newly seen workers, retiring pools for departed ones, and the endpoint-drift self-heal that rebuilds a worker's pool after it re-addresses (e.g. a worker IP change). Lower this to speed recovery after a worker re-address.</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">DATABASE_CITUS_SMART_ROUTING_WORKER_CONNECTION_TIMEOUT_MS</code> · <span class="config-def-label">Default</span> <code>10000</code></p> | ||
| <p class="config-def-desc">Connection timeout (ms) for direct worker pools; bounds the boot reachability probe and runtime borrow-wait — keep short for fail-fast.</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">DATABASE_CITUS_SMART_ROUTING_FAILOVER_REFRESH_DEBOUNCE_MS</code> · <span class="config-def-label">Default</span> <code>10000</code></p> | ||
| <p class="config-def-desc">FAILOVER STORY (HA workers, e.g. Patroni leader+replica pairs): when a worker leader is demoted, the HA manager rewrites pg_dist_node to the new leader and the pools self-heal without waiting for the scheduled refresh tick. Worker pools are unconditionally hardened against non-writable (standby / read-only) servers: pool URLs pin targetServerType=primary (the driver refuses to connect to a read-only server) and pooled connections are write-validated at borrow, so connections pinned to a demoted leader are evicted immediately. On top of that, the first routed operation failing with a failover signature (SQLSTATE 25006 "read-only transaction", or a worker connection-acquisition failure) triggers an immediate asynchronous catalog refresh + pool reconcile. This knob debounces that trigger: at most one error-triggered refresh runs per window, so a burst of failing operations collapses into a single refresh and there is no refresh storm while the catalog has not flipped to the new leader yet (the scheduled placement_refresh_interval_ms tick remains the backstop).</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">DATABASE_CITUS_RELATION_QUERY_MAX_RESOLVED_ENTITIES</code> · <span class="config-def-label">Default</span> <code>1000000</code></p> | ||
| <p class="config-def-desc">Citus-only defensive cap on how many entity ids a relation/reference recursion may materialize on the coordinator heap before binding. A breach fails the query with an error naming this property instead of risking a coordinator out-of-memory condition.</p> | ||
| </div> | ||
| </div> | ||
|
|
||
| ## Cassandra driver configuration parameters | ||
|
|
@@ -664,7 +700,7 @@ import Banner from '~/components/Banner.astro'; | |
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">SQL_ATTRIBUTES_BATCH_THREADS</code> · <span class="config-def-label">Default</span> <code>3</code></p> | ||
| <p class="config-def-desc">batch thread count has to be a prime number like 3 or 5 to gain perfect hash distribution</p> | ||
| <p class="config-def-desc">batch thread count has to be a prime number like 3 or 5 to gain perfect hash distribution. When database.citus.enabled=true this is overridden by database.citus.shard_count (see that property for pool sizing)</p> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the Worth noting the lowercase style is consistent across all five |
||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">SQL_ATTRIBUTES_VALUE_NO_XSS_VALIDATION</code> · <span class="config-def-label">Default</span> <code>false</code></p> | ||
|
|
@@ -708,7 +744,7 @@ import Banner from '~/components/Banner.astro'; | |
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">SQL_TS_LATEST_BATCH_THREADS</code> · <span class="config-def-label">Default</span> <code>3</code></p> | ||
| <p class="config-def-desc">batch thread count has to be a prime number like 3 or 5 to gain perfect hash distribution</p> | ||
| <p class="config-def-desc">batch thread count has to be a prime number like 3 or 5 to gain perfect hash distribution. When database.citus.enabled=true this is overridden by database.citus.shard_count (see that property for pool sizing)</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">SQL_TS_UPDATE_BY_LATEST_TIMESTAMP</code> · <span class="config-def-label">Default</span> <code>true</code></p> | ||
|
|
@@ -1281,6 +1317,10 @@ import Banner from '~/components/Banner.astro'; | |
| <p class="config-def-meta"><code class="config-def-env">CACHE_MAXIMUM_POOL_SIZE</code> · <span class="config-def-label">Default</span> <code>16</code></p> | ||
| <p class="config-def-desc">max pool size to process futures that call the external cache</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">CACHE_KEY_PREFIX</code></p> | ||
| <p class="config-def-desc">Prefix prepended to every Redis cache key by the transactional cache base. Empty by default. Useful when several environments share one Redis instance (e.g. a Redis Cluster where the redis.db logical-database isolation is unavailable) and must not collide on cache keys.</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">CACHE_ATTRIBUTES_ENABLED</code> · <span class="config-def-label">Default</span> <code>true</code></p> | ||
| <p class="config-def-desc">make sure that if cache.type is 'redis' and cache.attributes.enabled is 'true' if you change 'maxmemory-policy' Redis config property to 'allkeys-lru', 'allkeys-lfu' or 'allkeys-random'</p> | ||
|
|
@@ -1289,6 +1329,10 @@ import Banner from '~/components/Banner.astro'; | |
| <p class="config-def-meta"><code class="config-def-env">CACHE_TS_LATEST_ENABLED</code> · <span class="config-def-label">Default</span> <code>true</code></p> | ||
| <p class="config-def-desc">Will enable cache-aside strategy for SQL timeseries latest DAO. make sure that if cache.type is 'redis' and cache.ts_latest.enabled is 'true' if you change 'maxmemory-policy' Redis config property to 'allkeys-lru', 'allkeys-lfu' or 'allkeys-random'</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">CACHE_ALARMS_MAX_ALARM_TYPE_NAMES_PER_TENANT</code> · <span class="config-def-label">Default</span> <code>1000</code></p> | ||
| <p class="config-def-desc">Max per-tenant alarm type names kept in the in-memory registration cache (see BaseAlarmService for the rationale).</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">CACHE_SPECS_RELATIONS_TTL</code> · <span class="config-def-label">Default</span> <code>1440</code></p> | ||
| <p class="config-def-desc">Relations cache TTL</p> | ||
|
|
@@ -1557,6 +1601,14 @@ import Banner from '~/components/Banner.astro'; | |
| <p class="config-def-meta"><code class="config-def-env">CACHE_SPECS_ALARM_TYPES_MAX_SIZE</code> · <span class="config-def-label">Default</span> <code>10000</code></p> | ||
| <p class="config-def-desc">0 means the cache is disabled</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">CACHE_SPECS_ALARM_TYPE_NAMES_TTL</code> · <span class="config-def-label">Default</span> <code>60</code></p> | ||
| <p class="config-def-desc">Alarm type names cache TTL</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">CACHE_SPECS_ALARM_TYPE_NAMES_MAX_SIZE</code> · <span class="config-def-label">Default</span> <code>10000</code></p> | ||
| <p class="config-def-desc">0 means the cache is disabled</p> | ||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">CACHE_SPECS_MOBILE_APP_SETTINGS_TTL</code> · <span class="config-def-label">Default</span> <code>1440</code></p> | ||
| <p class="config-def-desc">Qr code settings cache TTL</p> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,7 +108,7 @@ import Banner from '~/components/Banner.astro'; | |
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">TB_KAFKA_COMPRESSION_TYPE</code> · <span class="config-def-label">Default</span> <code>none</code></p> | ||
| <p class="config-def-desc">none or gzip</p> | ||
| <p class="config-def-desc">none, gzip or lz4</p> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not actionable in this repo. This page is generated by |
||
| </div> | ||
| <div class="config-def-item"> | ||
| <p class="config-def-meta"><code class="config-def-env">TB_KAFKA_BATCH_SIZE</code> · <span class="config-def-label">Default</span> <code>16384</code></p> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 8df625f — in the generator rather than the page.
These pages are generated by
scripts/generate_config_pages.py, and the<br />was not authored here:generate_sectionjoined every line of the source YAML comment with<br />, so this description (thingsboard.yml:328-329, which merely soft-wraps mid-sentence) got a line break in the middle of the clause. The generator now breaks only at sentence boundaries, and the page was regenerated fromrelease/license/4.3.