Skip to content

Commit 8b6a512

Browse files
committed
docs: 更新 README 添加多进程联调和机器人压测说明
1 parent 478cffa commit 8b6a512

1 file changed

Lines changed: 53 additions & 1 deletion

File tree

README.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,58 @@ volumes:
426426
mongodb_data:
427427
```
428428
429+
### 🧪 多进程跨进程联调(MongoDB + Docker)
430+
431+
当前仓库已提供 `docker-compose.multi.yml`,包含:
432+
- `mongo` x1
433+
- `game` x2(`game-1`、`game-2`)
434+
- `social` x2(`social-1`、`social-2`)
435+
436+
#### 启动环境
437+
438+
```bash
439+
docker compose -f docker-compose.multi.yml up -d --build
440+
docker compose -f docker-compose.multi.yml ps
441+
```
442+
443+
#### 一键跨进程 smoke 测试
444+
445+
```bash
446+
./scripts/multi/smoke-cross-process.sh
447+
```
448+
449+
脚本会验证:
450+
- `game-1 -> social` 跨进程调用
451+
- `game-2 -> social` 跨进程调用
452+
- 返回 `code=0` 且 `FriendCount >= 1`
453+
454+
#### 常用排查命令
455+
456+
```bash
457+
docker compose -f docker-compose.multi.yml logs -f game-1 game-2 social-1 social-2
458+
docker compose -f docker-compose.multi.yml down
459+
```
460+
461+
#### 机器人 RPC 登录/断开压测(Client)
462+
463+
> 说明:当前项目中,账号校验与角色创建仍走 HTTP 接口,角色登录与在线流程走 TCP/RPC。
464+
> 这个脚本用于模拟真实客户端反复“登录 -> 在线 -> 主动断开 -> 重连登录”。
465+
466+
```bash
467+
./scripts/multi/run-bots-rpc.sh
468+
```
469+
470+
可选环境变量:
471+
472+
```bash
473+
BOT_COUNT=200 \
474+
TCP_PORT=49100 \
475+
LOGIN_URL=http://127.0.0.1:48080/game/api/ \
476+
DISCONNECT_AFTER_LOGIN_SECONDS=20 \
477+
RUN_SECONDS=300 \
478+
./scripts/multi/run-bots-rpc.sh
479+
```
480+
429481
### 🔍 监控与可观测性
430482

431483
#### 指标端点
@@ -472,4 +524,4 @@ volumes:
472524

473525
**Made with ❤️ by GameFrameX Team**
474526

475-
</div>
527+
</div>

0 commit comments

Comments
 (0)