Frage

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!

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top