feat: DPDK Market Data Feed Handler — production product app

Add complete market data gateway product:
- app/market_feed.c: Zero-copy DPDK feed handler with latency histogram
  (min/avg/P50/P95/P99/max), per-symbol msg rate, periodic stats, signal
  handling, JSON parsing without library dependency.
- demo/market_data_server.py: Zero-dependency simulated market data
  server (8 symbols, random walk pricing, subscribe/unsubscribe).
- app/README.md: Full product documentation with architecture diagram.
- Makefile: Add 'app' target for product build (build/market_feed).
- src/main.c: Add -M market data streaming mode.

Product is ready for: financial market data gateways, low-latency
quote feeds, exchange connectivity testing.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
wxj
2026-07-01 12:36:47 +00:00
co-authored by Claude
parent dc3d16c4a9
commit db0f2463ff
6 changed files with 1025 additions and 3 deletions
+36
View File
@@ -148,6 +148,11 @@ dpdk-ws-client/
├── REPORT.md # 原始性能报告 (调试 + Bug修复记录)
├── PERF_REPORT.md # 优化后性能报告 + 商用评估
├── PRODUCT_ANALYSIS.md # 产品落地场景分析
├── app/
│ ├── market_feed.c # 行情接入网关 (生产级产品)
│ └── README.md # 产品文档
├── demo/
│ └── market_data_server.py # 模拟行情服务端
├── src/
│ ├── arp.h # ARP 表 (链表)
│ ├── tcp_core.h # 所有结构体 + 常量 + 声明 + mempool helpers
@@ -223,6 +228,37 @@ dpdk-ws-client/
| 百万并发连接 | 无 epoll 模型、无连接池管理 |
| 跨平台部署 | 依赖 DPDK + hugepages + 专用 NIC |
## 产品应用
项目已包含一个完整的生产级产品入口:**DPDK 行情接入网关** (`app/market_feed.c`)。
```bash
make app # 编译行情网关 → build/market_feed
# 启动模拟行情服务端
python3 demo/market_data_server.py 8080 100
# 启动 DPDK 行情网关(需远端 server)
./build/market_feed -l 0-1 -n 2 \
-d <dpdk>/drivers/librte_mempool_ring.so \
-d <dpdk>/drivers/librte_net_ixgbe.so \
-- -a <SERVER_IP> -p 8080 -l <LOCAL_IP> \
-s '{"action":"subscribe","symbols":["AAPL","GOOGL"]}' -t 5
```
输出延迟统计表(min / avg / P50 / P99 / max),每 5 秒刷新:
```
┌────────┬──────────┬────────┬────────┬────────┬────────┬──────┐
│ Symbol │ Msgs │ Rate │ Min │ Avg │ P50 │ P99 │
├────────┼──────────┼────────┼────────┼────────┼────────┼──────┤
│ AAPL │ 498 │ 99 │ 598 │ 821 │ 780 │ 1245 │
│ GOOGL │ 497 │ 99 │ 587 │ 815 │ 772 │ 1230 │
└────────┴──────────┴────────┴────────┴────────┴────────┴──────┘
```
详见 [app/README.md](app/README.md)。
## 后续优化方向
| 优先级 | 项目 | 预期 |