what is event driven web server

前端 未结 3 1630
攒了一身酷
攒了一身酷 2020-12-05 04:48

I want to understand basics of Event Driven web server, I know one of them is Tornado, but any other information is much appreciated.

Thanks

3条回答
  •  不知归路
    2020-12-05 05:32

    A web server needs to handle concurrent connections. There are many ways to do this, some of them are:

    • A process per connection.
    • A process per connection, and have a pool of processes ready to use.
    • A thread per connection.
    • A thread per connection, and have a pool of threads ready to use.
    • A single process, handle every event (accepted connection, data available to read, can write to client, ...) on a callback.
    • Some combination of the above.
    • ...

    At the end, the distinction ends up being in how you store each connection state (explicitly in a context structure, implicitly in the stack, implicitly in a continuation, ...) and how you schedule between connections (let the OS scheduler do it, let the OS polling primitives do it, ...).

提交回复
热议问题