witty-profiler配置指南:从基础设置到生产环境部署
witty-profiler配置指南从基础设置到生产环境部署【免费下载链接】witty-profilerThe witty-profiler is an automated data and control stream topology detection and bottleneck analysis tool for AI training and inferencing systems.项目地址: https://gitcode.com/openeuler/witty-profiler前往项目官网免费下载https://ar.openeuler.org/ar/欢迎来到witty-profiler的终极配置指南 本文将带您从零开始全面掌握这款强大的AI训练和推理系统性能分析工具的配置方法。无论您是初学者还是经验丰富的系统管理员都能在这里找到适合您的配置方案。什么是witty-profilerwitty-profiler是openEuler社区开发的一款自动化数据和控制流拓扑检测工具专门为AI训练和推理系统设计。它能自动收集进程关系、IPC活动、设备拓扑和运行时上下文数据并将这些异构观测结果融合成统一的可分析拓扑图帮助您快速定位性能瓶颈、重建依赖路径并实现自动化诊断。 基础安装与环境配置环境要求witty-profiler支持Python 3.11及以上版本建议使用uv进行包管理# 创建虚拟环境 uv venv .venv --python 3.11 source .venv/bin/activate # 安装核心依赖 uv sync # 安装HTTP服务端支持可选 uv sync --group server # 安装所有组件 uv sync --group all构建eBPF工具为了启用底层性能数据采集功能需要构建eBPF工具witty-profiler-build # 或 python -m witty_profiler.tools.build构建完成后您可以使用--verify参数验证工具状态witty-profiler --verify⚙️ 配置文件详解witty-profiler的配置采用JSON格式遵循清晰的层级结构。配置文件位于 collector/python/configs/ 目录下。配置加载优先级配置按以下优先级加载高优先级覆盖低优先级CLI命令行参数- 最高优先级配置文件- 通过--config指定框架默认值- 内置默认配置核心配置文件结构完整的配置结构如下{ tmp_dir: 临时文件目录, server_config: { server_addr: {host: 绑定地址, port: 绑定端口}, preferred_backend: 后端选择 }, collector_config: { disabled_collectors: [], seed_graph_collectors: [], remote_slaves: [], socket_collector_config: {}, numa_collector_config: {}, rdma_collector_config: {} }, sniffer_config: { socket_sniffer: {}, cpu_sniffer: {}, npu_sniffer: {}, gpu_sniffer: {}, rdma_sniffer: {} } }快速开始配置创建一个简单的配置文件my_config.json{ tmp_dir: local/run/witty_profiler, server_config: { server_addr: {host: 0.0.0.0, port: 18090} }, collector_config: { disabled_collectors: [], seed_graph_collectors: [ NPUCollector, GPUCollector, RemoteCollector, NumaCollector, RDMACollector, StaticCollector, CommonProcessParentCollector ] } } 运行模式配置离线批量模式适用于一次性性能分析任务# 运行30秒的离线采集 witty-profiler --offline --duration 30 # 监控特定进程 witty-profiler --offline --duration 60 --pid 1234 # 使用自定义配置 witty-profiler --offline --config my_config.json --duration 120HTTP服务模式启用REST API服务支持实时监控# 启动默认服务端口18090 witty-profiler # 自定义端口和主机 witty-profiler --host 192.168.1.100 --port 8080 # 使用生产环境配置 witty-profiler --config configs/production.json导出配置模板# 导出当前完整配置 witty-profiler --dump-config full_config.json # 查看配置优先级 witty-profiler --help | grep config 高级配置选项采集器配置优化在 collector/python/configs/collector_config.py 中您可以微调各种采集器的行为Socket采集器配置socket_collector_config: { enable_thread_node: true, min_thread_packet_threshold: 10, enable_filter: true, filter_conn_packet_cnt: 5, filter_conn_data_size: 240 }NUMA采集器配置numa_collector_config: { enable_thread_node: true, min_thread_ctxt_switch_pct_thresh: 0.1, min_thread_cpu_pct_thresh: 0.1 }嗅探器性能调优在 collector/python/configs/sniffer_config.py 中可以调整底层数据采集参数sniffer_config: { socket_sniffer: { monitor_report_maximum_interval_by_second: 2.0, maximum_dataframe_size_in_seconds: 30, entry_buffer_size: 20000 }, cpu_sniffer: { monitor_report_maximum_interval_by_second: 2.0 }, gpu_sniffer: { refresh_interval_by_second: 30.0 } } 生产环境部署指南安全配置建议网络绑定在生产环境中建议绑定到特定IP而非0.0.0.0权限管理确保witty-profiler有足够的权限访问系统性能数据日志轮转配置合理的日志文件大小和轮转策略{ tmp_dir: /var/run/witty_profiler, server_config: { server_addr: {host: 10.0.1.100, port: 18090} }, sniffer_config: { socket_sniffer: { maximum_log_file_size_in_mb: 500, maximum_rotation_cnt: 10 } } }分布式监控配置witty-profiler支持多节点监控配置collector_config: { remote_slaves: [ { slave_addr: {host: 10.0.1.101, port: 18090}, query_interval_by_second: 10.0 }, { slave_addr: {host: 10.0.1.102, port: 18090}, query_interval_by_second: 10.0 } ] }资源限制配置对于资源受限的环境{ sniffer_config: { socket_sniffer: { entry_buffer_size: 10000, # 减少缓冲区大小 maximum_dataframe_size_in_seconds: 15 # 缩短数据窗口 } }, collector_config: { disabled_collectors: [RDMACollector, NPUCollector] # 禁用不需要的采集器 } } 常见配置场景场景1快速性能诊断# 快速启动监控所有进程 witty-profiler --offline --duration 30 --log-level INFO # 导出诊断配置 witty-profiler --dump-config quick_diagnosis.json场景2长期监控服务创建monitoring_config.json{ tmp_dir: /opt/witty_profiler/data, server_config: { server_addr: {host: localhost, port: 18090} }, sniffer_config: { socket_sniffer: { maximum_log_file_size_in_mb: 1000, maximum_rotation_cnt: 20, monitor_report_maximum_interval_by_second: 5.0 } } }启动服务witty-profiler --config monitoring_config.json场景3GPU/NPU专用监控{ collector_config: { seed_graph_collectors: [ NPUCollector, GPUCollector, NumaCollector, SocketCollector, CommonProcessParentCollector ] }, sniffer_config: { npu_sniffer: { refresh_interval_by_second: 10.0 # 更频繁的NPU监控 }, gpu_sniffer: { refresh_interval_by_second: 10.0 # 更频繁的GPU监控 } } } 配置验证与调试配置验证命令# 验证配置语法 python -m witty_profiler.config_manager.validate my_config.json # 查看当前生效的配置 witty-profiler --dump-config current_config.json # 测试特定采集器 witty-profiler --offline --duration 5 --pid $(pgrep python)日志级别设置witty-profiler支持多种日志级别# 详细调试信息 witty-profiler --log-level VERBOSE # 生产环境推荐 witty-profiler --log-level INFO # 仅关键错误 witty-profiler --log-level ERROR 性能优化建议内存优化调整缓冲区大小根据系统内存调整entry_buffer_size优化数据窗口平衡maximum_dataframe_size_in_seconds与内存使用选择性采集通过disabled_collectors禁用不需要的采集器CPU优化调整采集间隔增加monitor_report_maximum_interval_by_second减少CPU负载线程级节点控制根据需求启用/禁用enable_thread_node过滤阈值调整合理设置filter_conn_packet_cnt和filter_conn_data_size️ 故障排除常见问题权限问题确保有足够的权限运行eBPF工具端口冲突检查端口18090是否被占用配置错误使用--dump-config验证配置调试步骤# 步骤1验证基础功能 witty-profiler --verify # 步骤2测试最小配置 witty-profiler --offline --duration 10 --log-level DEBUG # 步骤3检查日志文件 tail -f /var/log/witty_profiler.log 监控与维护健康检查# 检查服务状态 curl http://localhost:18090/health # 查看运行统计 curl http://localhost:18090/stats # 获取拓扑图 curl http://localhost:18090/graph定期维护清理临时文件定期清理tmp_dir目录日志轮转配置日志管理系统配置备份定期备份生产环境配置 总结通过本文的指南您应该已经掌握了witty-profiler从基础配置到生产环境部署的全过程。记住以下关键点从简单开始先使用默认配置再逐步调整理解配置优先级CLI参数 配置文件 默认值监控资源使用根据系统负载调整采集参数利用导出功能使用--dump-config了解当前配置witty-profiler的强大之处在于其灵活的配置系统让您可以根据不同的AI训练和推理场景进行精准调优。现在就开始配置您的witty-profiler开启高效的性能分析之旅吧✨提示更多高级配置选项和API文档请参考项目中的 官方文档 和 配置指南。【免费下载链接】witty-profilerThe witty-profiler is an automated data and control stream topology detection and bottleneck analysis tool for AI training and inferencing systems.项目地址: https://gitcode.com/openeuler/witty-profiler创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考