menu

uvicorn限制并发数目

并发虽然好,内存爆掉也很无奈

Resource Limits

限制并发

  • --limit-concurrency <int> - Maximum number of concurrent connections or tasks to allow, before issuing HTTP 503 responses. Useful for ensuring known memory usage patterns even under over-resourced loads.

限制最多请求

  • --limit-max-requests <int> - Maximum number of requests to service before terminating the process. Useful when running together with a process manager, for preventing memory leaks from impacting long-running processes.
  • --backlog <int> - Maximum number of connections to hold in backlog. Relevant for heavy incoming traffic. Default: 2048
编辑