What data for this category looks like
Data for this category primarily comes from temperature and humidity sensors, vibration sensors, stress monitors, and video surveillance devices deployed inside tunnels. Data update rhythms fall into two categories: sensor data is pushed every 1 to 5 seconds, and video frame data generates one record every 100 to 300 milliseconds. Each individual alarm document includes fields such as unique device identifier, alarm type code, collection timestamp, threshold deviation value, associated sensor number, and on-site associated file URL. Numeric fields correspond to physical quantity units: temperature in degrees Celsius, vibration in millimeters per second, and stress in megapascals.
Constraints on database and operations workflows
High-frequency real-time sensor data generates high concurrent write requests. Database connection pool configuration must match peak write volume to avoid connection exhaustion. When storing mixed data types, separate structured alarm metadata and unstructured video files. Use a relational database and object storage respectively to prevent single-database storage bloat. Frequent updates to timestamp fields require database indexes optimized for the time dimension. Otherwise, querying historical alarms will experience delays. A single data record has multiple fields and includes associated identifiers. Design joint indexes appropriately to support quick filtering by device and time range.
How to set configurations
This document uses FastGPT v4.17.0 for reference.
| Configuration Item | Recommended Setting | Rationale |
|---|---|---|
PG_URL | postgresql://user:pass@db-host:5432/tunnel_alarm_db?sslmode=require | Stores structured alarm metadata, supports joint queries by device and time range |
DB_MAX_LINK | 180–250 | Matches peak connection count for high-frequency tunnel sensor writes, avoids write failures caused by connection exhaustion |
REDIS_URL | redis://:redis-pass@redis-host:6379/1 | Caches temporary alarm status and device heartbeat data, reduces read pressure on the primary database |
MONGODB_URI | mongodb://user:mongo-pass@mongo-host:27017/tunnel_media?retryWrites=true&w=majority | Stores metadata and unstructured logs associated with video alarms |
| Batch write threshold | First 50 entries | Combines high-frequency small packet sensor write requests to reduce database interactions |
| Database write timeout | 60 seconds | Adapts to the time required for batch sensor data writes, avoids single-write timeouts interrupting batch tasks |
Three frequently made configuration errors
- Phenomenon: Database connection failure is displayed in the interface, and the log returns a
connection refusederror. Cause: Connection address or permissions forPG_URLorMONGODB_URIare incorrectly configured, preventing establishment of a database session. - Phenomenon: Zero results are returned when executing an alarm filter query. Cause: No joint index is created for the timestamp field, and the database full table scan times out, returning empty results.
- Phenomenon: Connection timeout occurs during batch sensor data writes. Cause: The
DB_MAX_LINKconfiguration value is too low, and cannot support the concurrent connection count required for peak writes.
How to confirm correct configuration
- Run database connection test scripts to verify that configurations for
PG_URL,MONGODB_URI, andREDIS_URLcan establish normal connections. - Import a single simulated alarm record, and check that the storage format and units of corresponding fields in the database meet expected standards.
- Send batch simulated write requests, and confirm that the
DB_MAX_LINKconfiguration supports concurrent writes without connection exhaustion errors. - Query alarm data by device ID and time range, and confirm that the index configuration returns query results quickly.
The values provided are common starting points and should be evaluated against the reader's own samples.
Question material comes from public community discussions. Configuration values are common starting points and should be measured against your own samples. Verified on 2026-09-28.