Skip to content

Commit c3d4e97

Browse files
authored
Merge pull request #60 from MigoXLab/ldap
Ldap
2 parents dee7f89 + e407582 commit c3d4e97

101 files changed

Lines changed: 6431 additions & 3039 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ results/
1919
upload_files/
2020
tmp/
2121

22-
23-
# env
24-
.env
25-
2622
# frontend
2723
dist/
2824
node_modules
@@ -42,3 +38,7 @@ code_check/
4238
coverage.xml
4339
bandit-report.json
4440
htmlcov
41+
42+
# env
43+
backend/.env
44+
st_engine/.env

README.md

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
- [General API Load Testing](#general-api-load-testing)
3131
- [🔧 Configuration](#-configuration)
3232
- [Database Configuration](#database-configuration)
33+
- [LDAP/AD Authentication Configuration](#ldapad-authentication-configuration)
3334
- [Resource Configuration](#resource-configuration)
3435
- [🤝 Development Guide](#-development-guide)
3536
- [Technology Stack](#technology-stack)
36-
- [Project Structure](#project-structure)
3737
- [Development Environment Setup](#development-environment-setup)
3838
- [🗺️ Development Roadmap](#️-development-roadmap)
3939
- [In Development](#in-development)
@@ -61,7 +61,7 @@ LMeterX is a professional large language model performance testing platform that
6161
- **Professional Metrics** - Core performance metrics including first token latency, throughput(RPS、TPS), and success rate
6262
- **AI Smart Reports** &nbsp;<img src="docs/images/badge-new.svg" alt="NEW" height="16" /> - AI-powered performance analysis, multi-dimensional model comparison and visualization
6363
- **Web Console** - One-stop management for task creation, stopping, status tracking, and full-chain log monitoring
64-
- **Enterprise-level Deployment** - Docker containerization with elastic scaling and distributed deployment support
64+
- **Enterprise-level Deployment** - Docker containerization with elastic scaling and distributed deployment support, &nbsp;<img src="docs/images/badge-new.svg" alt="NEW" height="16" /> Built-in LDAP/AD integration for enterprise user authentication and SSO
6565

6666
### Feature Comparison
6767
| Dimension | LMeterX | EvalScope | llmperf |
@@ -157,6 +157,41 @@ DB_PASSWORD=lmeterx_password # Database password (use secrets management in pro
157157
DB_NAME=lmeterx # Database name
158158
```
159159

160+
### LDAP/AD Authentication Configuration
161+
162+
```bash
163+
# ================= LDAP Authentication Configuration =================
164+
# Enable or disable LDAP authentication (on/off)
165+
LDAP_ENABLED=on
166+
167+
# LDAP server connection
168+
LDAP_SERVER=ldap://ldap.example.com # LDAP server address
169+
LDAP_PORT=389 # LDAP server port (389 for LDAP, 636 for LDAPS)
170+
LDAP_USE_SSL=false # Use SSL/TLS connection (true for LDAPS)
171+
LDAP_TIMEOUT=5 # Connection timeout in seconds
172+
173+
# LDAP search configuration
174+
LDAP_SEARCH_BASE=dc=example,dc=com # Base DN for user search
175+
LDAP_SEARCH_FILTER=(sAMAccountName={username}) # LDAP search filter
176+
177+
# Authentication method 1: Direct bind with DN template (recommended for simple setups)
178+
LDAP_USER_DN_TEMPLATE=cn={username},ou=users,dc=example,dc=com
179+
180+
# Authentication method 2: Bind with service account (recommended for Active Directory)
181+
LDAP_BIND_DN=cn=service,ou=users,dc=example,dc=com # Service account DN
182+
LDAP_BIND_PASSWORD=service_password # Service account password
183+
184+
# JWT configuration (optional)
185+
JWT_SECRET_KEY=your-secret-key-here # JWT signing key (change in production)
186+
JWT_EXPIRE_MINUTES=480 # Token expiration time in minutes (default: 8 hours)
187+
```
188+
189+
**Configuration Notes:**
190+
- **Simple LDAP Setup**: Use `LDAP_USER_DN_TEMPLATE` for direct user binding
191+
- **Active Directory**: Use `LDAP_BIND_DN` + `LDAP_BIND_PASSWORD` for service account binding
192+
- **Security**: Always use `LDAP_USE_SSL=true` in production environments
193+
- **Frontend**: Set `VITE_LDAP_ENABLED=on` to enable login UI
194+
160195
### Resource Configuration
161196
```bash
162197
# ================= High-Concurrency Load Testing Deployment Requirements =================
@@ -191,19 +226,6 @@ LMeterX adopts a modern technology stack to ensure system reliability and mainta
191226
- **Frontend Interface**: React + TypeScript + Ant Design + Vite
192227
- **Deployment & Operations**: Docker + Docker Compose + Nginx
193228

194-
### Project Structure
195-
196-
```
197-
LMeterX/
198-
├── backend/ # Backend service
199-
├── st_engine/ # Load testing engine service
200-
├── frontend/ # Frontend service
201-
├── docs/ # Documentation directory
202-
├── docker-compose.yml # Docker Compose configuration
203-
├── Makefile # Run complete code checks
204-
├── README.md # English README
205-
```
206-
207229
### Development Environment Setup
208230

209231
1. **Fork the Project** to your GitHub account

README_CN.md

Lines changed: 86 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,35 @@
1313
</p>
1414
</div>
1515

16-
> ⭐ 如果你喜欢这个项目,请点击右上角的 "Star" 按钮支持我们。你的支持是我们前进的动力!
16+
# LMeterX
1717

1818
## 内容导航
19-
- [内容导航](#内容导航)
20-
- [📋 项目简介](#-项目简介)
21-
- [✨ 核心特性](#-核心特性)
22-
- [工具对比](#工具对比)
23-
- [🏗️ 系统架构](#️-系统架构)
24-
- [🚀 快速开始](#-快速开始)
25-
- [环境检查清单](#环境检查清单)
26-
- [一键部署(推荐)](#一键部署推荐)
27-
- [数据目录与挂载说明](#数据目录与挂载说明)
28-
- [使用指南](#使用指南)
29-
- [LLM API 压测](#llm-api-压测)
30-
- [通用 API 压测](#通用-api-压测)
31-
- [🔧 配置说明](#-配置说明)
32-
- [数据库配置](#数据库配置)
33-
- [资源配置](#资源配置)
34-
- [🤝 开发指南](#-开发指南)
35-
- [技术栈](#技术栈)
36-
- [开发环境搭建](#开发环境搭建)
37-
- [🗺️ 发展路线图](#️-发展路线图)
38-
- [开发中](#开发中)
39-
- [规划中](#规划中)
40-
- [🗂️ 数据集引用说明](#️-数据集引用说明)
41-
- [👥 贡献](#-贡献)
42-
- [📝 引用](#-引用)
43-
- [📄 开源许可](#-开源许可)
19+
- [LMeterX](#lmeterx)
20+
- [内容导航](#内容导航)
21+
- [📋 项目简介](#-项目简介)
22+
- [✨ 核心特性](#-核心特性)
23+
- [工具对比](#工具对比)
24+
- [🏗️ 系统架构](#️-系统架构)
25+
- [🚀 快速开始](#-快速开始)
26+
- [环境检查清单](#环境检查清单)
27+
- [一键部署(推荐)](#一键部署推荐)
28+
- [数据目录与挂载说明](#数据目录与挂载说明)
29+
- [使用指南](#使用指南)
30+
- [🔧 配置说明](#-配置说明)
31+
- [数据库配置](#数据库配置)
32+
- [LDAP/AD 认证配置](#ldapad-认证配置)
33+
- [资源配置](#资源配置)
34+
- [🤝 开发指南](#-开发指南)
35+
- [技术栈](#技术栈)
36+
- [开发环境搭建](#开发环境搭建)
37+
- [🗺️ 发展路线图](#️-发展路线图)
38+
- [开发中](#开发中)
39+
- [规划中](#规划中)
40+
- [📚 相关文档](#-相关文档)
41+
- [👥 贡献者](#-贡献者)
42+
- [🗂️ 数据集引用说明](#️-数据集引用说明)
43+
- [📄 开源许可](#-开源许可)
44+
- [本项目采用 Apache 2.0 许可证。](#本项目采用-apache-20-许可证)
4445

4546
## 📋 项目简介
4647

@@ -55,13 +56,12 @@ LMeterX 是一个专业的大语言模型性能测试平台,支持基于大模
5556

5657
- **通用框架支持** - 兼容主流推理框架(vLLM、LiteLLM、TensorRT-LLM)和云服务(Azure、AWS、Google Cloud)
5758
- **全模型兼容** - 支持 GPT、Claude、Llama 等主流大模型,也支持[MinerU](https://github.com/opendatalab/MinerU)[dots.ocr](https://github.com/rednote-hilab/dots.ocr)等文档解析大模型
58-
- **通用API压测**&nbsp;<img src="docs/images/badge-new.svg" alt="NEW" height="16" /> - 支持任意业务服务的HTTP API压测,支持curl命令一键解析和自定义数据集批量压测
5959
- **高负载压测** - 模拟高并发请求,精准探测模型性能极限
6060
- **多场景覆盖**&nbsp;<img src="docs/images/badge-new.svg" alt="NEW" height="16" /> - 支持流式/非流式、文本/多模态/自定义数据集
6161
- **专业指标统计** - 首Token延迟、吞吐量(RPS、TPS)、成功率等核心性能指标
6262
- **AI智能报告**&nbsp;<img src="docs/images/badge-new.svg" alt="NEW" height="16" /> - 提供 AI 智能分析报告,多维度多模型可视化结果对比
6363
- **Web控制台** - 提供任务创建、停止、状态跟踪、全链路日志监控等一站式管理
64-
- **企业级部署** - Docker容器化,支持弹性扩展与分布式部署
64+
- **企业级部署** - Docker容器化,支持弹性扩展与分布式部署&nbsp;<img src="docs/images/badge-new.svg" alt="NEW" height="16" /> 内置 LDAP/AD 集成,支持企业用户认证和单点登录
6565

6666
### 工具对比
6767

@@ -117,9 +117,7 @@ curl -fsSL https://raw.githubusercontent.com/MigoXLab/LMeterX/main/quick-start.s
117117

118118
### 使用指南
119119

120-
#### LLM API 压测
121-
122-
1. **访问界面**: 打开 http://localhost:8080,切换到「LLM API」标签页
120+
1. **访问界面**: 打开 http://localhost:8080
123121
2. **创建任务**: 导航至 测试任务 → 创建任务,配置 API 请求信息、测试数据以及请求响应字段映射
124122
- 2.1 基础信息: 对于 OpenAI-like 和 Claude-like API 只需填写 API 路径、模型与响应模式,也可在请求参数中补充完整 payload
125123
- 2.2 数据&负载: 根据需要选择数据集类型、并发数、压测时间等
@@ -128,22 +126,8 @@ curl -fsSL https://raw.githubusercontent.com/MigoXLab/LMeterX/main/quick-start.s
128126
3. **API 测试**: 在 测试任务 → 创建任务,点击基础信息面板的「测试」按钮,快速验证接口连通性(建议使用简短 prompt)
129127
4. **实时监控**: 访问 测试任务 → 日志/监控中心,查看全链路测试日志,快速定位异常
130128
5. **结果分析**: 进入 测试任务 → 结果,查看详细性能指标并导出报告
131-
6. **性能对比**: 在 性能对比 模块选择多个模型/版本,进行多维度性能对比
132-
7. **AI 分析**: 在 测试任务 → 结果 或者 性能对比页面,可对单个或多个任务进行AI分析和评估
133-
134-
#### 通用 API 压测
135-
136-
1. **访问界面**: 打开 http://localhost:8080,切换到「通用API」标签页
137-
2. **创建任务**: 导航至 测试任务 → 创建任务
138-
- 填写完整 curl 命令,点击「一键解析」,系统会自动解析请求方法、URL、Headers、请求体等信息
139-
- 检查解析后的请求信息是否完整且准确
140-
3. **API 测试**: 点击「测试」按钮,测试 API 连通性,确保压测前请求信息准确
141-
4. **数据集准备**(可选): 若要使用数据集压测,请提前准备好 JSONL 格式文件上传,每行必须是一个完整的 payload JSON 对象
142-
5. **启动压测**: 配置并发用户数、压测时长等参数,点击「创建」启动压测任务
143-
6. **实时监控**: 测试过程中可点击「日志」按钮,查看压测情况和实时日志
144-
7. **结果分析**: 测试完成后可点击「结果」按钮,查看压测结果,包括 RPS、响应时间、成功率等指标
145-
8. **复制模板**: 如需压测相同的 API,可在操作列点击「...」→「复制模板」,注意复制模板后数据集需要重新上传,建议重复步骤 3-7
146-
9. **性能对比**: 如需比较不同版本、不同并发下的性能,可前往「性能对比」页面进行对比
129+
6. **结果对比**: 在 模型擂台 模块选择多个模型/版本,进行多维度性能对比
130+
7. **AI 分析**: 在 测试任务 → 结果/模型擂台 中配置 AI 分析服务后,可对单个或多任务进行智能评估
147131

148132
## 🔧 配置说明
149133

@@ -157,6 +141,41 @@ DB_PASSWORD=lmeterx_password
157141
DB_NAME=lmeterx
158142
```
159143

144+
### LDAP/AD 认证配置
145+
146+
```bash
147+
=== LDAP 认证配置 ===
148+
# 启用或禁用 LDAP 认证 (on/off),默认关闭
149+
LDAP_ENABLED=on
150+
151+
# LDAP 服务器连接配置
152+
LDAP_SERVER=ldap://ldap.example.com # LDAP 服务器地址
153+
LDAP_PORT=389 # LDAP 服务器端口 (389为LDAP,636为LDAPS)
154+
LDAP_USE_SSL=false # 是否使用 SSL/TLS 连接 (LDAPS使用true)
155+
LDAP_TIMEOUT=5 # 连接超时时间(秒)
156+
157+
# LDAP 搜索配置
158+
LDAP_SEARCH_BASE=dc=example,dc=com # 用户搜索基准 DN
159+
LDAP_SEARCH_FILTER=(sAMAccountName={username}) # LDAP 搜索过滤器
160+
161+
# 认证方式 1: 使用 DN 模板直接绑定(适用于简单 LDAP 场景)
162+
LDAP_USER_DN_TEMPLATE=cn={username},ou=users,dc=example,dc=com
163+
164+
# 认证方式 2: 使用服务账号绑定(适用于 Active Directory)
165+
LDAP_BIND_DN=cn=service,ou=users,dc=example,dc=com # 服务账号 DN
166+
LDAP_BIND_PASSWORD=service_password # 服务账号密码
167+
168+
# JWT 配置(可选)
169+
JWT_SECRET_KEY=your-secret-key-here # JWT 签名密钥(生产环境请修改)
170+
JWT_EXPIRE_MINUTES=480 # Token 过期时间(分钟,默认8小时)
171+
```
172+
173+
**配置说明:**
174+
- **简单 LDAP 部署**: 使用 `LDAP_USER_DN_TEMPLATE` 进行用户直接绑定
175+
- **Active Directory**: 使用 `LDAP_BIND_DN` + `LDAP_BIND_PASSWORD` 进行服务账号绑定
176+
- **安全性**: 生产环境务必设置 `LDAP_USE_SSL=true`
177+
- **前端配置**: 设置 `VITE_LDAP_ENABLED=on` 以启用登录界面
178+
160179
### 资源配置
161180
```bash
162181
=== 高并发压测 部署要求 ===
@@ -185,16 +204,6 @@ deploy:
185204
- **前端** - React + TypeScript + Ant Design + Vite
186205
- **部署** - Docker + Docker Compose + Nginx
187206

188-
```
189-
LMeterX/
190-
├── backend/ # 后端服务
191-
├── st_engine/ # 压测引擎
192-
├── frontend/ # 前端服务
193-
├── docs/ # 文档
194-
├── docker-compose.yml
195-
└── README_CN.md # 中文说明
196-
```
197-
198207
### 开发环境搭建
199208

200209
1. **Fork项目** → 克隆到本地
@@ -211,6 +220,19 @@ LMeterX/
211220
### 规划中
212221
- [ ] CLI 命令行工具
213222

223+
## 📚 相关文档
224+
225+
- [部署指南](docs/DEPLOYMENT_GUIDE_CN.md) - 详细部署说明
226+
- [贡献指南](docs/CONTRIBUTING.md) - 参与开发指南
227+
- [数据集使用指南](docs/DATASET_GUIDE.md) - 自定义图文数据集准备与使用说明
228+
229+
## 👥 贡献者
230+
231+
感谢所有为 LMeterX 做出贡献的开发者:
232+
233+
- [@LuckyYC](https://github.com/LuckyYC) - 项目维护者 & 核心开发者
234+
- [@del-zhenwu](https://github.com/del-zhenwu) - 核心开发者
235+
214236
## 🗂️ 数据集引用说明
215237

216238
> LMeterX 基于开源 ShareGPT 数据集构建测试样本,严格遵循原始许可要求。
@@ -220,33 +242,13 @@ LMeterX/
220242
- 筛选高质量对话样本,剔除低质量或与压测场景无关的数据
221243
- 进行随机抽样,减轻数据规模的同时保留多样化对话
222244

223-
## 👥 贡献
224-
225-
我们欢迎来自社区的任何贡献!请参考我们的 [贡献指南](docs/CONTRIBUTING.md)
226-
感谢所有为 LMeterX 做出贡献的开发者!
227-
228-
<a href="https://github.com/MigoXLab/LMeterX/graphs/contributors" target="_blank">
229-
<table>
230-
<tr>
231-
<th colspan="2">
232-
<br><img src="https://contrib.rocks/image?repo=MigoXLab/LMeterX"><br><br>
233-
</th>
234-
</tr>
235-
</table>
236-
</a>
237-
238-
## 📝 引用
239-
如果您在研究中使用了 LMeterX,请引用我们的工作:
240-
241-
```bibtex
242-
@software{LMeterX2025,
243-
author = {LMeterX Team},
244-
title = {LMeterX: Enterprise-Grade Performance Benchmarking Platform for Large Language Models},
245-
year = {2025},
246-
url = {https://github.com/MigoXLab/LMeterX},
247-
}
248-
```
249-
250245
## 📄 开源许可
251246

252247
本项目采用 [Apache 2.0 许可证](LICENSE)
248+
---
249+
250+
<div align="center">
251+
252+
**⭐ 如果这个项目对您有帮助,请给我们一个 Star!您的支持是我们持续改进的动力。**
253+
254+
</div>

backend/.flake8

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,20 @@ per-file-ignores =
5959
# __init__.py files can have unused imports and be empty
6060
__init__.py:F401,D104,W391,E261
6161
# Test files can have unused imports and long lines
62-
test_*.py:F401,E501,D100,D103
63-
*_test.py:F401,E501,D100,D103
62+
test_*.py:F401,E501,D100,D102,D103
63+
*_test.py:F401,E501,D100,D102,D103
64+
# App entrypoint can be thin and self-explanatory
65+
app.py:D103
6466
# API files can have some flexibility
65-
api/*.py:F403,F405
67+
api/*.py:F403,F405,D103
68+
# Service layer often uses self-explanatory helpers
69+
service/*.py:D103
70+
# Middleware classes are small and clear in context
71+
middleware/*.py:D102,D103,D107
72+
# Model methods are mostly CRUD helpers
73+
model/*.py:D102
74+
# Settings container does not need docstrings
75+
utils/auth_settings.py:D106
6676
# Fix script can have unused imports
6777
fix_code_*.py:F401
6878

0 commit comments

Comments
 (0)