Skip to content

Conversation

@carryaimp
Copy link

  1. 通过k8s部署,生产环境通过gunicorn方式启动,根据deploy资源的resource.limits.cpu字段自适配cpu资源限制,最佳worker数量为分配的IO密集项目cpu核心数*2+1
  2. 容器内部的日志输出到终端
  3. 同步代码(依赖标准库的I/O操作,如 socket、time.sleep 等)默认是阻塞的,需要通过gevent的猴子补丁(monkey patching)将其替换为非阻塞版本,否则gevent无法在I/O时切换协程,性能会大打折扣

@carryaimp carryaimp force-pushed the performance_optimization branch from 21779aa to 9c73e3a Compare October 16, 2025 08:54
@carryaimp carryaimp changed the title worker数量自适应与gevent模块猴子补丁Performance optimization worker数量自适应与gevent模块猴子补丁 Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant