一个高性能、低延迟的Rust交易系统,支持高并发订单处理。
# 1. 构建系统
make build-release
# 2. 启动系统
make run-background
# 3. 运行测试
make quick-test
# 4. 查看结果
make status
详细步骤请参考 QUICK_START.md
- 吞吐量: 20万订单/秒
- 延迟: 微秒级响应
- 并发: 支持数千并发连接
- 稳定性: 7x24小时稳定运行
测试场景 | 客户端数 | 吞吐量 | 平均延迟 | 状态 |
---|---|---|---|---|
小规模 | 5 | ~1,000 订单/秒 | ~100μs | ✅ |
中等规模 | 10 | ~3,600 订单/秒 | ~680μs | ✅ |
大规模 | 50 | ~14,500 订单/秒 | ~1,150μs | ✅ |
- 语言: Rust
- 异步运行时: Tokio
- 网络: TCP with TCP_NODELAY
- 数据结构: DashMap, BTreeMap, Crossbeam
- 序列化: Serde JSON
- 监控: 自定义指标收集
- ✅ 订单匹配引擎
- ✅ 实时订单簿
- ✅ 市场数据推送
- ✅ 高性能网络层
- ✅ 内存池管理
- ✅ 监控和指标
- 🔄 异步处理
- 🔒 内存安全
- 📈 性能监控
- 🔧 配置管理
- 📊 指标收集
# 基础功能测试
make quick-test
# 性能测试
make perf-test
# 压力测试
make stress-test
# 查看所有测试命令
make help
# 运行完整测试套件
make full-test
# 自定义性能测试
cargo run --example performance_test -- --clients 10 --orders-per-second 2000 --duration 5
# 查看系统状态
make status
# 查看实时日志
make logs
# 完整监控信息
make monitor
- 订单处理速率
- 交易执行延迟
- 内存使用情况
- 网络连接状态
系统通过 config.json
进行配置:
{
"engine": {
"matching_threads": 16,
"order_queue_size": 1000000,
"trade_queue_size": 100000
},
"network": {
"host": "0.0.0.0",
"port": 8080,
"max_connections": 10000
},
"metrics_port": 9090
}
# 构建生产版本
make build-release
# 后台启动
make run-background
# 验证部署
make status
# 构建镜像
docker build -t rust-dex .
# 运行容器
docker run -p 8080:8080 -p 9090:9090 rust-dex
# 查看所有命令
make help
# 查看系统信息
make info
# 查看测试脚本帮助
./scripts/quick_test.sh --help
- 查看 测试指南 中的故障排除部分
- 检查系统日志:
make logs
- 验证系统状态:
make status
欢迎提交 Issue 和 Pull Request!
# 克隆项目
git clone <repository-url>
cd rust-dex
# 安装依赖
cargo build
# 运行测试
make test
MIT License
详细的性能测试结果请参考 PERFORMANCE_REPORT.md
提示: 首次使用建议先阅读 QUICK_START.md 进行快速测试。