If I have a web server with 10 process and 10 threads, what does that mean?
ht开发者_高级运维tp://pypi.python.org/pypi/Spawning/
So I'm playing with Spawning... If I run it with 10 process and 10 threads, what does that mean?
I'm building a chat room (long-polling using eventlet). Does that mean that only 10 people can be present in the chat room?
No. It all depends on the architecture of your application. Event-based apps can support large amounts of connections (users, sessions, whatever matters in your app) in a single thread.
You usually need multiple threads when you're performing blocking IO operations, and multiple processes when you need true computational load distribution. In something simple like a chat application, you can easily avoid the need for both. The standard Python library has the asyncore
and asynchat
modules which you may find interesting. The Twisted library is a more comprehensive approach.
No. Having a certain number of threads/processes doesn't create or change any kind of limit on the content or clients. Having more threads/processes can improve the performance of an application when balanced across them, especially on SMP systems where a single-thread or single-process architecture would be limited to one CPU.
精彩评论