質問

am sorry for this dumb question, but am really confused; and i hope you'll correct me where am wrong.

in the thread based servers (like Apache), i understand that for each client, a new 'worker' will be created for him to serve all his needs.

in the event driven (like Nginx and Tornado), this comes my confusion, espetially where there is a Not Thread Safe like the Python's GIL; from what i understand, there is ONE SINGLE LOOP that will handle ALL client requests, so as my dumb understanding, if there are 10 000 simultanous connections, i dont see how to serve ALL those 10 thousend requests!

役に立ちましたか?

解決

In event-driven servers you just handle connections (read()s and write()s from specific connections, really) one after the other, using non-blocking calls. You usually use some call to multiplex between connections (select(), poll(), ...), which tell you which connections need to be serviced, and you service them in turn.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top