按《全平台设备性能监控系统商业化实施方案 V4.0》落地的可运行骨架。 架构主线: - 职责下沉:采集/保活/传输收敛为单一 Rust 核心(rust-core/),经 C FFI 复用 - 网关无状态:连接态/订阅/在线态全部外置 Redis;授权走 PostgreSQL - 存储精简:PostgreSQL + TimescaleDB 承载元数据与时序 - 有界优先:所有缓存/队列/集合均有明确上限与超限策略 - 协议双模:JSON / MessagePack(含数值量化 + 结构指纹缓存) 关键实现: - shared/codec.js MessagePack 量化编解码,稳态上行省 ~24% - shared/protocol.js 信封校验 / 字段白名单 / 版本兼容 / 编码协商 - server/gateway/ 无状态 Socket.io 网关(seq 去重、竞态防护) - server/business/ 账号 / 配对 / 授权 / 审计 - deploy/ nginx + gateway + business + redis + timescaledb 编排 质量验证(共 157 项,bash tests/run-all.sh 一键复现): - 协议契约 34/34、编解码 64/64、Rust 单测 8/8 - 端到端冒烟 24/24、持久化与重启恢复 24/24 - 断连竞态残留 3/3(100 轮零等待重连零残留) - 泄漏专项:GC 后稳态 heap_used 0.0%,会话与订阅零残留 修复的关键缺陷: - 量化按数值类型判定导致三类静默误缩放 -> 改为按路径位置量化 - 协议白名单/仓储层/建表语句字段名与采集端不一致 -> 静默丢全部数据 - 授权缓存无法跨进程失效 -> Redis pub/sub 广播 + TTL 兜底 - await 期间断连导致在线态永久残留(实测 94% 泄漏率)-> session gone 标记 - 容器 network_mode: host 导致服务名解析失败 -> 改默认桥接网络 - nginx 强依赖证书导致 clone 后必崩 -> 默认 HTTP-only + HTTPS 模板 文档:docs/ 下含方案正文、单页 HTML 报告与 DOCX。
22 lines
1.0 KiB
Plaintext
22 lines
1.0 KiB
Plaintext
MIT License
|
|
|
|
Copyright (c) 2026 PMon
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|