我使用服务员运行我的烧瓶应用程序,代码如下:
from waitress import serve
if __name__ == "__main__":
serve(application, host='0.0.0.0', port=SERVER_PORT)当我就这样离开它的时候,我可以在控制台上看到服务员在工作:
[test@gmail.com] /api/v1/messages_public?)
2021-07-07 19:55:43,277 - waitress.queue - add_task - WARNING - Task queue depth is 2
2021-07-07 19:55:43,379 - aa_api_data - parse_and_store_insights_from_message - INFO - Msg insert DB - type [file] date [2 years ago] id [a037c16153d525470f03f5d65ef14a7a]
[test@gmail.com] /api/v1/messages_public?)
2021-07-07 19:55:43,809 - waitress.queue - add_task - WARNING - Task queue depth is 2
2021-07-07 19:55:43,848 - aa_api_data - parse_and_store_insights_from_message - INFO - Msg insert DB - type [file] date [2 years ago] id [244d260340a4cd1d528e6f6014aacd27]但是,当我像这样指定线程计数时:
serve(application, host='0.0.0.0', port=SERVER_PORT, threads=50)我只在控制台中看到这个输出,没有服务生加载项:
[test@gmail.com] /api/v1/messages_public?)
[test@gmail.com] /api/v1/messages_public?)
[test@gmail.com] /api/v1/messages_public?)
[test@gmail.com] /api/v1/messages_public?)
[test@gmail.com] /api/v1/messages_public?)
[test@gmail.com] /api/v1/messages_public?)它似乎也没有进展得更快。我做错了什么吗?我只想在运行这个py脚本时加快机器上的进程。
发布于 2022-09-13 12:15:30
您将无法从服务员可用的给定参数中更改任何线程值,您所做的工作似乎与所能做的一样多,如果您的pc还没有超过您的pc,则可能会超过它,尽管这可能有点极端。
https://buildmedia.readthedocs.org/media/pdf/waitress/latest/waitress.pdf
你可以在第11页的第1.6章中找到服务员API
serve(app, listen=’0.0.0.0:8080’, unix_socket=None, unix_socket_perms=’600’, threads=4,
url_scheme=’http’, url_prefix=”, ident=’waitress’, backlog=1024, recv_bytes=8192,
send_bytes=1, outbuf_overflow=104856, outbuf_high_watermark=16777216, in-
buf_overflow=52488, connection_limit=1000, cleanup_interval=30, channel_timeout=120,
log_socket_errors=True, max_request_header_size=262144, max_request_body_size=1073741824,
expose_tracebacks=False)https://stackoverflow.com/questions/68328130
复制相似问题