Files
junhong_cmp_fiber/migrations/000047_create_tb_polling_concurrency_config.up.sql
huang 931e140e8e
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m35s
feat: 实现 IoT 卡轮询系统(支持千万级卡规模)
实现功能:
- 实名状态检查轮询(可配置间隔)
- 卡流量检查轮询(支持跨月流量追踪)
- 套餐检查与超额自动停机
- 分布式并发控制(Redis 信号量)
- 手动触发轮询(单卡/批量/条件筛选)
- 数据清理配置与执行
- 告警规则与历史记录
- 实时监控统计(队列/性能/并发)

性能优化:
- Redis 缓存卡信息,减少 DB 查询
- Pipeline 批量写入 Redis
- 异步流量记录写入
- 渐进式初始化(10万卡/批)

压测工具(scripts/benchmark/):
- Mock Gateway 模拟上游服务
- 测试卡生成器
- 配置初始化脚本
- 实时监控脚本

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 17:32:44 +08:00

25 lines
1.1 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 并发控制配置表
CREATE TABLE IF NOT EXISTS tb_polling_concurrency_config (
id BIGSERIAL PRIMARY KEY,
task_type VARCHAR(50) NOT NULL UNIQUE,
max_concurrency INT NOT NULL DEFAULT 50,
description TEXT,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_by BIGINT
);
-- 索引
CREATE INDEX idx_polling_concurrency_task_type ON tb_polling_concurrency_config(task_type);
-- 表注释
COMMENT ON TABLE tb_polling_concurrency_config IS '并发控制配置表 - 控制不同类型任务的最大并发数';
-- 列注释
COMMENT ON COLUMN tb_polling_concurrency_config.task_type IS '任务类型realname/carddata/package/stop_start';
COMMENT ON COLUMN tb_polling_concurrency_config.max_concurrency IS '最大并发数';
COMMENT ON COLUMN tb_polling_concurrency_config.description IS '配置说明';
COMMENT ON COLUMN tb_polling_concurrency_config.created_at IS '创建时间';
COMMENT ON COLUMN tb_polling_concurrency_config.updated_at IS '更新时间';
COMMENT ON COLUMN tb_polling_concurrency_config.updated_by IS '更新人ID';