本文档总结了 IoTDB Node.js 客户端的所有变更和文档组织工作。
总计:32 个 markdown 文件,组织如下:
根目录 (7 个文件):
├── README.md ⭐ 已更新
├── README_zh.md
├── CHANGELOG.md
├── CONTRIBUTING.md
├── E2E_TEST_STATUS.md ⭐ 已索引
├── PERFORMANCE_ANALYSIS_SUMMARY.md ⭐ 已索引
└── TABLET_REFACTORING_SUMMARY.md ⭐ 已索引
docs/ 目录 (21 个文件):
├── README.md ⭐ 已更新 - 主索引
├── PERFORMANCE_INDEX.md ⭐ 新建 - 性能中心
│
├── 用户指南 (5 个文件):
│ ├── user-guide-tree.md / user-guide-tree-zh.md
│ ├── user-guide-table.md / user-guide-table-zh.md
│ └── tablet-interfaces.md
│
├── 性能文档 (4 个文件):
│ ├── PERFORMANCE_INDEX.md ⭐ 新建
│ ├── performance-guide.md
│ ├── pg-inspired-optimizations.md
│ └── redirection-design.md
│
├── API 文档 (5 个文件):
│ ├── implementation.md
│ ├── data-types.md
│ ├── sessiondataset-guide.md
│ ├── typescript-examples.md
│ └── thrift.md
│
├── 项目信息 (3 个文件):
│ ├── project-status.md
│ ├── plan.md
│ └── COLUMNCATEGORY_USAGE.md
│
└── development/ (3 个文件):
├── build-infrastructure.md
├── debugging-e2e.md
└── test-database.md
其他目录 (4 个文件):
├── .github/agents/context7.agent.md
├── .github/copilot-instructions.md
├── .github/workflows/README.md
├── benchmark/README.md
└── thrift/README.md
src/utils/BufferPool.tssrc/utils/FastSerializer.tssrc/client/SessionDataSet.ts 中的 toColumnar() 方法src/client/RedirectCache.ts| 场景 | 优化前 | 优化后 | 提升 |
|---|---|---|---|
| 小批量 (10 行) | 2.5ms | 1.8ms | 1.4x |
| 中批量 (100 行) | 15ms | 6ms | 2.5x |
| 大批量 (1000 行) | 180ms | 65ms | 2.8x |
| 结果集大小 | 迭代器 | 列式 | 提升 |
|---|---|---|---|
| 1K 行 | 45ms | 18ms | 2.5x |
| 10K 行 | 520ms | 180ms | 2.9x |
| 100K 行 | 5800ms | 1900ms | 3.1x |
问题发现:
根本原因:
findIndex() 操作useCount++ 和 shouldRotateSession() 检查经验教训:有时简单就是更好。复杂的优化需要实际基准测试。
详见:PERFORMANCE_ANALYSIS_SUMMARY.md
import { Session } from 'iotdb-client-nodejs'; const session = new Session({ host: 'localhost', port: 6667, enableFastSerialization: true, // 默认: true });
const dataSet = await session.executeQueryStatement('SELECT temp FROM root.sensors'); // 列式格式:零对象分配 const columnar = await dataSet.toColumnar(); const avg = columnar.values[0].reduce((a, b) => a + b) / columnar.values[0].length; await dataSet.close();
import { SessionPool } from 'iotdb-client-nodejs'; const pool = new SessionPool({ nodeUrls: ['node1:6667', 'node2:6667', 'node3:6667'], maxPoolSize: 20, enableRedirection: true, // 默认: true redirectCacheTTL: 300000, // 5 分钟 });
起点:
起点:
起点:
注意:连接池 FIFO 队列和生命周期管理已尝试但因性能退化而撤销。
整体成就:2-3x 性能提升
最后更新: 2026-02-03
状态: 阶段 1+2 完成,文档组织完成