Files
junhong_cmp_fiber/scripts/benchmark/start_redis.sh
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

49 lines
1006 B
Bash
Executable File
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.
#!/bin/bash
# 启动本地 Redis 用于压测
set -e
echo "=== 启动本地 Redis ==="
# 检查是否已有容器在运行
if docker ps | grep -q polling-redis; then
echo "Redis 容器已在运行"
docker ps | grep polling-redis
exit 0
fi
# 停止并删除旧容器(如果存在)
docker rm -f polling-redis 2>/dev/null || true
# 启动 Redis 容器
# - 16GB maxmemory压测用
# - 禁用持久化(提高性能)
docker run -d \
--name polling-redis \
-p 6379:6379 \
redis:7-alpine \
redis-server \
--maxmemory 8gb \
--maxmemory-policy allkeys-lru \
--appendonly no \
--save ""
echo ""
echo "等待 Redis 启动..."
sleep 2
# 验证连接
if redis-cli ping | grep -q PONG; then
echo "✓ Redis 启动成功"
echo ""
echo "连接信息:"
echo " 地址: 127.0.0.1:6379"
echo " 密码: (无)"
echo ""
echo "Redis 内存配置:"
redis-cli CONFIG GET maxmemory
else
echo "✗ Redis 启动失败"
exit 1
fi