what is event driven web server

前端 未结 3 1626
攒了一身酷
攒了一身酷 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:25

    There's a nice analogy of this described here:

    http://daverecycles.tumblr.com/post/3104767110/explain-event-driven-web-servers-to-your-grandma

    0 讨论(0)
  • 2020-12-05 05:29

    Event-driven manner aims at resolving the C10K Problem. It turns the traditional 'push model' into a 'pull model' to create a non-blocking evented I/O. Simply put, the event-driven architecture avoid spawning additional threads and thread context switching overheads, and usually ends up with better performance and less resource consumption.

    Some overview from a rails developer, also includes analogy: http://odysseyonrails.com/articles/8

    0 讨论(0)
  • 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, ...).

    0 讨论(0)
提交回复
热议问题