Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
82441c5
feat(coro_rpc): add URMA RDMA transport support
Jun 4, 2026
9c33a1f
feat(urma_example): add URMA example based on rdma_example
Jun 4, 2026
772614a
fix(coro_rpc): add urma_example subdirectory and fix urma_socket head…
Jun 4, 2026
b606010
add urma head
Jun 4, 2026
6e71e1b
fix bug
Jun 4, 2026
3a9b59a
add circle_buffer.hpp
Jun 4, 2026
93634ba
fix(urma): rename urma_device_t to urma_device_wrapper_t to avoid con…
Jun 4, 2026
2a963e9
fix(urma_socket): fix type name conflicts with URMA library
Jun 4, 2026
78a80f9
refactor(urma_socket): restructure for URMA CTP API
Jun 4, 2026
d2e1723
refactor(urma_socket): fix JFC/JFR/Jetty creation for CTP mode
Jun 4, 2026
8c52020
refactor(urma_socket): fix URMA CTP API usage and ASIO coroutine issues
Jun 4, 2026
8e22ea3
docs: add next steps plan for URMA CTP implementation
Jun 4, 2026
335e140
refactor(urma_socket): add ASIO socket compatibility for CTP mode
Jun 5, 2026
0db4e93
refactor(urma_socket): add endpoint-based connect like ib_socket
Jun 5, 2026
72f1c8e
docs(build): add URMA linker error note to build rules
Jun 5, 2026
c45a546
update
Jun 5, 2026
389e202
update
Jun 5, 2026
0e2beae
update
Jun 5, 2026
00e4eb3
update
Jun 5, 2026
803e7b5
update
Jun 5, 2026
8162a6c
update
Jun 5, 2026
ca242aa
update
Jun 5, 2026
902a5b4
update
Jun 5, 2026
7862da7
update
Jun 5, 2026
2389dde
update
Jun 5, 2026
a9ef1f0
update
Jun 5, 2026
366906f
update
Jun 5, 2026
5f9508f
update
Jun 5, 2026
fb03fbc
update
Jun 5, 2026
4a32cbf
update
Jun 5, 2026
aedd26c
update
Jun 7, 2026
715a743
update
Jun 7, 2026
423baa6
update
Jun 7, 2026
89cfa26
update
Jun 7, 2026
716a1e9
update
Jun 7, 2026
68889c1
update
Jun 7, 2026
38e1f33
update
Jun 7, 2026
ea9a458
update
Jun 7, 2026
477d255
update
Jun 7, 2026
020a01a
update
Jun 7, 2026
9dff091
update
Jun 7, 2026
e07ef48
update
Jun 7, 2026
3e73450
update
Jun 7, 2026
a7c2bad
update
Jun 7, 2026
1b2a06e
update
Jun 7, 2026
6a05509
update
Jun 8, 2026
28cd80e
update
Jun 8, 2026
b169c40
update
Jun 8, 2026
cbde2da
update
Jun 8, 2026
9a923f1
update
Jun 8, 2026
821bcff
update
Jun 8, 2026
a84ff89
update
Jun 8, 2026
42ee261
update
Jun 8, 2026
92fad43
update
Jun 8, 2026
568c1ac
update
Jun 8, 2026
38907a6
update
Jun 8, 2026
3d890b6
docs: add URMA RPC usage HTML
Jun 8, 2026
87d961d
add performance metric
Jun 15, 2026
11c3f12
glm-5.1修复多协程问题
Gzure Jun 16, 2026
674d55c
idle_poll_interval改成5us
Gzure Jun 17, 2026
2b11e7e
Merge pull request #1 from Gzure/supercache_dev_zjw
JerryLX Jun 17, 2026
0277265
编译问题
Gzure Jun 17, 2026
1d158f4
Merge branch 'main' into supercache_dev
JerryLX Jun 17, 2026
e5d6bf8
Merge pull request #1 from JerryLX/supercache_dev
JerryLX Jun 17, 2026
940fce8
Merge branch 'alibaba:main' into main
zchuango Jun 22, 2026
9ebc3d4
修改urma使能逻辑, 通过环境变量配置自动升级为urma
Gzure Jun 24, 2026
b88c3e8
修复用例问题
Gzure Jun 24, 2026
4739039
Merge branch 'supercache' into supercache_dev_zjw2
Gzure Jun 24, 2026
bccc742
Merge pull request #3 from Gzure/supercache_dev_zjw2
JerryLX Jun 24, 2026
63ace4c
fix: add urma_import_seg before urma_import_jetty to establish TP rou…
Gzure Jul 10, 2026
5dc9165
feat(urma): switch completion detection from busy-poll to JFCE event …
Gzure Jul 17, 2026
dc0fe33
fix(urma): avoid tuple_size<void> error with GCC 12 in event_loop yield
Gzure Jul 17, 2026
ad7874b
fix(urma): flatten urma_seg_t in urma_socket_info for struct_pack
Gzure Jul 17, 2026
c259203
fix(urma): use bondp_rjetty for bonding device in import_jetty
Gzure Jul 17, 2026
61cbff6
fix(urma): add missing urma_ubagg.h header for bondp_rjetty_t
Gzure Jul 17, 2026
856ef08
perf(urma): spin-poll after event wakeup to reduce latency under bursts
Gzure Jul 17, 2026
a7671e6
perf(urma): yield to scheduler in spin-poll to fix p999 tail latency
Gzure Jul 17, 2026
4d05369
perf(urma): remove post-yield, lower busy_poll_budget to 16
Gzure Jul 17, 2026
ade9e57
feat(rpc): add RPC stage profiling with env-based enable
Gzure Jul 17, 2026
2435dfe
feat(rpc): add connection lifecycle profiling stages
Gzure Jul 17, 2026
a150794
feat(rpc): print actual call count (calls) in addition to sampled count
Gzure Jul 18, 2026
929565f
feat(rpc): auto-print profile on process exit via atexit
Gzure Jul 22, 2026
499274a
fix(rpc): merge thread_local samples on thread exit for atexit print
Gzure Jul 22, 2026
82651f1
debug(rpc): print atexit trace to stderr to diagnose client-side silence
Gzure Jul 22, 2026
b8b71af
feat(rpc): add payload size bucketing to stage profile
Gzure Jul 22, 2026
40f78c3
feat(benchmark): add --no-urma option to use TCP instead of URMA
Gzure Jul 22, 2026
54d1331
添加urma_init失败报错码
Gzure Jul 23, 2026
1c660b3
fix(urma): fall back to plain urma_import_jetty if bonding path fails
Gzure Jul 23, 2026
fc4222f
fix(urma): tolerate urma_init URMA_FAIL when provider already loaded
Gzure Jul 23, 2026
1d6bfc3
fix(urma): set bonding STANDALONE+IODIE to fix first-SEND RNR (status…
Gzure Jul 23, 2026
a20acca
fix(urma): move urma_init_config_t before urma_device_manager
Gzure Jul 23, 2026
dae7e07
perf(urma): reduce wait_send/read_completion latency in event_loop
Gzure Jul 23, 2026
25fc9dc
feat(rpc): tree-structured profile output
Gzure Jul 23, 2026
bf4503e
feat(rpc): hierarchy tree profile output with parent-child stages
Gzure Jul 23, 2026
1fa8b1b
perf(urma): skip spin when callbacks pending to prevent starvation
Gzure Jul 23, 2026
6111b0d
feat(rpc): tree-style profile with branch connectors
Gzure Jul 23, 2026
c5a4138
perf(urma): short spin (4 polls) when callbacks pending for low latency
Gzure Jul 23, 2026
dcfe5ca
perf(urma): replace Promise/Future with callback_awaitor for send com…
Gzure Jul 24, 2026
7d0df47
fix(urma): use callback_awaitor directly instead of async_io<void>
Gzure Jul 24, 2026
198fcf7
perf(urma): direct poll before suspending in wait_urma_write_completion
Gzure Jul 24, 2026
20ae445
perf(urma): spin-poll 64 times in wait_urma_write_completion
Gzure Jul 24, 2026
b2a8294
perf(urma): increase send completion spin to 2000 iterations
Gzure Jul 24, 2026
141f6de
perf(urma): poll+sleep(5us) loop for send completion instead of busy-…
Gzure Jul 24, 2026
62d09c1
perf(urma): remove spin, pure sleep(5us)+poll loop for send completion
Gzure Jul 24, 2026
5ae7092
fix(urma): try plain urma_import_jetty first, bonding as fallback
Gzure Jul 24, 2026
c60ead8
feat(rpc): add server_deserialize_request stage profiling
Gzure Jul 24, 2026
47108de
feat(rpc): add server_handler_execute and server_serialize_result pro…
Gzure Jul 24, 2026
f15082b
perf(urma): revert to callback_awaitor for send, increase pending spi…
Gzure Jul 24, 2026
1822187
feat(rpc): add handler_execute, benchmark_rpc_call with payload bucke…
Gzure Jul 25, 2026
b8846f1
feat(urma): make poll_interval configurable via URMA_RPC_POLL_INTERVAL
Gzure Jul 25, 2026
2d41502
恢复wait_urma_write_completion
Gzure Jul 25, 2026
5e4d627
send poll
Gzure Jul 25, 2026
299b283
chore: ignore .worktrees/ and .zcode/ directories
Gzure Jul 25, 2026
5e43e4a
fix(urma): remove spin-poll from wait_urma_write_completion, fix SIGBUS
Gzure Jul 25, 2026
3b75bfa
feat(rpc): add benchmark_rpc_call profiling in coro_rpc_client::send_…
Gzure Jul 25, 2026
7c2c528
fix: replace lambda with direct co_await for rpc_call profiling
Gzure Jul 25, 2026
e605049
fix: separate deserialize call from co_return for type matching
Gzure Jul 25, 2026
258a81b
fix: move benchmark_rpc_call profiling to call() method
Gzure Jul 25, 2026
a00ddbe
fix: record benchmark_rpc_call inside deserialize_rpc_result
Gzure Jul 25, 2026
3552147
fix: use record_since_with_size for benchmark_rpc_call bucketing
Gzure Jul 27, 2026
cea6a49
feat(rpc): convert all record_since to record_since_with_size
Gzure Jul 27, 2026
767a57e
feat(rpc): show bucket breakdown for key stages in tree output
Gzure Jul 27, 2026
fcde092
fix: simplify bucket output format for visibility
Gzure Jul 27, 2026
24bae4c
feat(rpc): use request payload size for benchmark_rpc_call bucketing
Gzure Jul 27, 2026
9f2a814
feat(rpc): bucket benchmark_rpc_call by func_name instead of payload …
Gzure Jul 27, 2026
60367ed
fix: fallback to __PRETTY_FUNCTION__ when get_func_name returns empty
Gzure Jul 27, 2026
d9aec61
fix: make benchmark_rpc_call print work with func_name data
Gzure Jul 27, 2026
3f5a618
fix: always use record_rpc_call_by_name_since, fallback to 'rpc_call'
Gzure Jul 27, 2026
0e186b8
revert: go back to payload-size bucketing for benchmark_rpc_call
Gzure Jul 27, 2026
1a2645d
sl=6
Gzure Jul 29, 2026
5374438
docs(urma): consolidate usage documentation
Gzure Aug 12, 2026
9c5497d
docs(urma): expand transport and configuration guide
Gzure Aug 12, 2026
6df60a2
docs(urma): use mermaid architecture diagram
Gzure Aug 12, 2026
b0932fc
clean code
Gzure Aug 12, 2026
cf1d513
Merge branch 'urma_dev' into urma_event_mode
Gzure Aug 12, 2026
543f857
merge master
Gzure Aug 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions .claude/plans/urma-ctp-implementation-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# URMA CTP 实现计划

## 当前状态

### 已完成
1. `circle_buffer` 提取到 `coro_io/detail/circle_buffer.hpp`
2. `urma_device.hpp` 类型冲突修复(`urma_device_wrapper_t`)
3. `urma_socket.hpp` 基础重构
4. JFC/JFR/Jetty 创建流程修正

### 已知问题
1. `urma_query_jetty` 签名不正确
2. `urma_import_jetty` 参数结构错误
3. ASIO 协程兼容性问题
4. Socket wrapper 接口不匹配

---

## URMA CTP API 正确用法

### 1. JFC 创建 (Completion Channel)
```c
urma_jfc_cfg_t jfc_cfg = {};
jfc_cfg.depth = 64;
jfc_cfg.flag.value = 0;
jfc_cfg.jfce = nullptr; // polling mode
jfc_cfg.user_ctx = 0;
urma_jfc_t* jfc = urma_create_jfc(ctx, &jfc_cfg);
```

### 2. JFR 创建 (Receive Queue)
```c
urma_jfr_cfg_t jfr_cfg = {};
jfr_cfg.depth = recv_cnt;
jfr_cfg.flag.value = 0;
jfr_cfg.trans_mode = URMA_TM_RM;
jfr_cfg.max_sge = 1;
jfr_cfg.min_rnr_timer = 12;
jfr_cfg.jfc = jfc;
jfr_cfg.token_value = {};
urma_jfr_t* jfr = urma_create_jfr(ctx, &jfr_cfg);
```

### 3. Jetty 创建 (CTP Mode)
```c
urma_jetty_cfg_t jetty_cfg = {};
jetty_cfg.flag.bs.share_jfr = 1;
jetty_cfg.jfs_cfg.depth = send_cnt + 1;
jetty_cfg.jfs_cfg.flag.value = 0;
jetty_cfg.jfs_cfg.trans_mode = URMA_TM_RM;
jetty_cfg.jfs_cfg.jfc = jfc;
jetty_cfg.jfs_cfg.user_ctx = 0;
jetty_cfg.shared.jfr = jfr;
urma_jetty_t* jetty = urma_create_jetty(ctx, &jetty_cfg);
```

### 4. Jetty ID 获取
```c
// 通过 jetty->jfs_id.id 获取
uint32_t jetty_id = jetty->jfs_id.id;
```

### 5. Segment 注册
```c
urma_seg_cfg_t seg_cfg = {};
seg_cfg.va = (uint64_t)buffer;
seg_cfg.len = buffer_size;
seg_cfg.flag.bs.access = URMA_ACCESS_READ | URMA_ACCESS_WRITE;
seg_cfg.flag.bs.token_policy = URMA_TOKEN_NONE;
urma_target_seg_t* tseg = urma_register_seg(ctx, &seg_cfg);
```

### 6. 导入远端 Jetty
```c
urma_rjetty_t remote = {};
remote.jetty_id.eid = peer_eid;
remote.jetty_id.id = peer_jetty_id;
remote.trans_mode = URMA_TM_RM;
remote.type = URMA_JETTY;
remote.tp_type = URMA_CTP; // or URMA_RTP
urma_target_jetty_t* remote_tjetty = urma_import_jetty(ctx, &remote, nullptr);
```

### 7. 发送数据 (SEND)
```c
urma_sge_t sge = {
.addr = (uint64_t)buffer,
.len = data_len,
.tseg = local_tseg
};
urma_sg_t src = {
.sge = &sge,
.num_sge = 1
};
urma_send_wr_t send_wr = {
.src = src
};
urma_jfs_wr_t jfs_wr = {
.opcode = URMA_OPC_SEND,
.send = send_wr,
.tjetty = remote_tjetty
};
urma_post_jetty_send_wr(jetty, &jfs_wr, &bad_wr);
```

### 8. 轮询完成
```c
urma_cr_t cr[8];
int cnt = urma_poll_jfc(jfc, 8, cr);
for (int i = 0; i < cnt; ++i) {
// cr[i].completion_len - 传输字节数
// cr[i].status - 状态
// cr[i].flag.bs.s_r - 0=send, 1=recv
}
```

---

## 待修复清单

### 高优先级
- [ ] `urma_socket.hpp`: 修复 `urma_query_jetty` 调用
- [ ] `urma_socket.hpp`: 修复 `urma_import_jetty` 参数
- [ ] `urma_socket.hpp`: 正确获取 Jetty ID
- [ ] `socket_wrapper.hpp`: 添加缺失接口

### 中优先级
- [ ] ASIO 协程兼容性问题
- [ ] `await_ready` Future 使用错误
- [ ] `async_read/write` 调用方式

### 低优先级
- [ ] `urma_socket_info` 序列化格式
- [ ] 连接握手协议

---

## 参考文档

- URMA API Guide: `.claude/skills/query-urma-docs/URMA API Guide.ch.md`
- URMA User Guide: `.claude/skills/query-urma-docs/URMA User Guide.ch.md`
- URMA 头文件: `include/ylt/urma/urma_api.h`, `urma_types.h`
169 changes: 169 additions & 0 deletions .claude/plans/urma-ctp-next-steps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
# URMA CTP 实现计划 - 下一步

## 当前状态

### 已完成 ✅
1. `urma_socket.hpp` 重构修复:
- `urma_query_jetty` 调用已移除,直接通过 `jetty_->jetty_id.id` 访问
- `urma_import_jetty` 参数已正确初始化 (`trans_mode`, `type`, `tp_type`, `flag`)
- ASIO 协程兼容性问题已修复 (`async_simple::CurrentExecutor{}`)
- 添加缺失方法: `prepare_accept`, `get_remote_address`, `get_local_address`, `get_remote_qp_num`, `get_local_qp_num`
- 添加 `urma_md5_header`, `urma_md5_first_header` 常量

### 待解决问题 🔴

#### 1. urma_example.cpp 集成问题

**错误1**: `get_global_urma_device()` 不接受参数
```cpp
// 当前错误用法:
coro_io::get_global_urma_device({
.dev_name = "",
.buffer_pool_config = {...},
.eid_index = 0
});
```

**错误2**: `coro_rpc_client::config::socket_config` 是 variant 类型,不支持 URMA
```cpp
// 当前错误用法:
conf.socket_config = urma_config; // urma_socket_t::config_t 不能直接赋值
```

#### 2. 缺失的 API
- `urma_device_wrapper_t::init(const urma_config&)` - 需要支持完整配置
- `coro_rpc_client::config` variant 需要 URMA 类型支持

---

## 参考实现: ib_socket 集成模式

### ib_socket 的结构

```cpp
// ib_socket.hpp
class ib_socket_t {
public:
struct config_t {
uint32_t cq_size = 128;
uint16_t recv_buffer_cnt = 8;
uint16_t send_buffer_cnt = 4;
ibv_qp_type qp_type = IBV_QPT_RC;
ibv_qp_cap cap = {...};
std::shared_ptr<ib_device_t> device;
};

struct ib_socket_info {
uint8_t gid[16];
uint16_t lid;
uint32_t buffer_size;
uint32_t qp_num;
};

ib_socket_t(coro_io::ExecutorWrapper<>* executor, const config_t& config);
async_simple::coro::Lazy<std::error_code> connect(const std::string& addr, const std::string& port);
async_simple::coro::Lazy<std::error_code> accept() noexcept;
void prepare_accpet(asio::ip::tcp::socket soc) noexcept;
// ... 其他方法
};
```

### socket_wrapper 的 variant 支持

```cpp
// socket_wrapper.hpp
class socket_wrapper_t {
#ifdef YLT_ENABLE_IBV
std::unique_ptr<ib_socket_t> ib_socket_;
#endif
#ifdef YLT_ENABLE_URMA
std::unique_ptr<urma_socket_t> urma_socket_;
#endif

public:
template<typename T>
auto visit(T&& op) {
#ifdef YLT_ENABLE_IBV
if (ib_socket_) return op(*ib_socket_);
#endif
#ifdef YLT_ENABLE_URMA
if (urma_socket_) return op(*urma_socket_);
#endif
return op(*socket_);
}
};
```

---

## 下一步修改计划

### 阶段1: 修复 urma_example.cpp

#### 1.1 修改 get_global_urma_device() 支持配置参数

参考 ib_device 的初始化模式:

```cpp
// urma_device.hpp
inline bool urma_device_wrapper_t::init(const urma_init_config_t& config) {
// 支持配置参数初始化
}
```

#### 1.2 修改 coro_rpc_client::config 支持 URMA

需要在 variant 中添加 URMA 类型:

```cpp
// coro_rpc_client.hpp
struct config_t {
using socket_config_t = std::variant<
tcp_config,
tcp_with_ssl_config,
tcp_with_ntiles_config
#ifdef YLT_ENABLE_URMA
, urma_socket_t::config_t // 添加 URMA 支持
#endif
>;
socket_config_t socket_config;
};
```

### 阶段2: 实现 URMA 连接的建立流程

#### 2.1 参考 ib_socket 的连接建立

```cpp
// ib_socket 连接流程:
async_simple::coro::Lazy<std::error_code> connect(const std::string& addr, const std::string& port) {
// 1. TCP 连接
// 2. 交换 socket_info (gid, lid, buffer_size, qp_num)
// 3. 初始化 QP
// 4. 返回
}
```

#### 2.2 URMA CTP 模式连接

根据 URMA API Guide,CTP 模式流程:
1. 创建 JFC (Completion Channel)
2. 创建 JFR (Receive Queue)
3. 创建 Jetty (Combined send/recv)
4. 通过 TCP 交换 Jetty ID 和 EID
5. 导入远端 Jetty
6. 建立连接

### 阶段3: 测试验证

1. 单元测试: urma_socket 基本功能
2. 集成测试: urma_example 与 coro_rpc 集成

---

## 参考文档

- URMA API Guide: `.claude/skills/query-urma-docs/URMA API Guide.ch.md`
- URMA User Guide: `.claude/skills/query-urma-docs/URMA User Guide.ch.md`
- ib_socket 实现: `include/ylt/coro_io/ibverbs/ib_socket.hpp`
- socket_wrapper: `include/ylt/coro_io/socket_wrapper.hpp`
50 changes: 50 additions & 0 deletions .claude/rules/common/agents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Agent Orchestration

## Available Agents

Located in `~/.claude/agents/`:

| Agent | Purpose | When to Use |
|-------|---------|-------------|
| planner | Implementation planning | Complex features, refactoring |
| architect | System design | Architectural decisions |
| tdd-guide | Test-driven development | New features, bug fixes |
| code-reviewer | Code review | After writing code |
| security-reviewer | Security analysis | Before commits |
| build-error-resolver | Fix build errors | When build fails |
| e2e-runner | E2E testing | Critical user flows |
| refactor-cleaner | Dead code cleanup | Code maintenance |
| doc-updater | Documentation | Updating docs |
| rust-reviewer | Rust code review | Rust projects |

## Immediate Agent Usage

No user prompt needed:
1. Complex feature requests - Use **planner** agent
2. Code just written/modified - Use **code-reviewer** agent
3. Bug fix or new feature - Use **tdd-guide** agent
4. Architectural decision - Use **architect** agent

## Parallel Task Execution

ALWAYS use parallel Task execution for independent operations:

```markdown
# GOOD: Parallel execution
Launch 3 agents in parallel:
1. Agent 1: Security analysis of auth module
2. Agent 2: Performance review of cache system
3. Agent 3: Type checking of utilities

# BAD: Sequential when unnecessary
First agent 1, then agent 2, then agent 3
```

## Multi-Perspective Analysis

For complex problems, use split role sub-agents:
- Factual reviewer
- Senior engineer
- Security expert
- Consistency reviewer
- Redundancy checker
Loading