CherryPy and concurrency

风格不统一 提交于 2019-12-19 04:22:10

问题


I'm using CherryPy in order to serve a python application through WSGI.

I tried benchmarking it, but it seems as if CherryPy can only handle exactly 10 req/sec. No matter what I do.

Built a simple app with a 3 second pause, in order to accurately determine what is going on... and I can confirm that the 10 req/sec has nothing to do with the resources used by the python script.

__

Any ideas?


回答1:


By default, CherryPy's builtin HTTP server will use a thread pool with 10 threads. If you are still using the defaults, you could try increasing this in your config file.

[global]
server.thread_pool = 30
  • See the cpserver documentation
  • Or the archive.org copy of the old documentation



回答2:


Your client needs to actually READ the server's response. Otherwise the socket/thread will stay open/running until timeout and garbage collected.

use a client that behaves correctly and you'll see that your server will behave too.



来源:https://stackoverflow.com/questions/2685089/cherrypy-and-concurrency

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!