Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Gunicorn - Pycon FR 2014

Gunicorn - Pycon FR 2014

Presenation of the new design of gunicorn and changes in the communnity.

Benoit Chesneau

October 26, 2014
Tweet

More Decks by Benoit Chesneau

Other Decks in Technology

Transcript

  1. the thundering herd and other concurrency programming challenges Pycon FR

    2014 - Lyon By Benoit Chesneau http:/ /goo.gl/QBW0DH
  2. prefork-worker model share sockets between OS processes (workers) each worker

    waits (accepts) for a connection an arbiter supervises the workers gunicorn design
  3. prefork-worker model share sockets between OS processes (workers) each worker

    waits (accepts) for a connection an arbiter supervises the workers gunicorn design
  4. the arbiter workflow check the 
 signal queue handle the

    signal not empty empty murder workers sleep manage workers
  5. sync worker accept only 1 connection at a time async/non

    blocking workers accept many connections sync workers, always behind a proxy Does your application have blocking operations? Does your application send/receive messages/ events (HTTP2, Pipelines, Websockets, SSE, PUSH…)? Which one to choose?
  6. All process can be awoken on accept for the same

    connection can trigger EAGAIN increase the CPU usage for nothing. not true with modern OSes for 1 socket the thundering herd problem
  7. ticket Gunicorn#792, Introduce signaling between workers and the arbiter using

    a Pipe Use our own internal messaging implementation the arbiter checks if the a socket can read Workers asks for more work or notify they are alive fixing thundering herd: how to solve it
  8. the arbiter has a new job All workers need to

    be updated new signaling API to be handled by the worker: an helper module will be provided introduce complexity
  9. with one socket, let all workers accepting if wanted depending

    on the load, bypass the signaling possible optimisations
  10. no more gunicorn_django, gunicorn_paster fix preloading issue offer the same

    experience for all WSGI applications new settings: —paste, —pythonpath, —env, 
 —reload Only one command in 20.0 (deprecations are removed) gunicorn - the only command
  11. ticket Gunicorn#837 plugins everywhere: logging, workers more embeddable: the gunicorn

    engine A new organization: 
 http:/ /github.com/gunicorn WIP: Deadline 2014/12 Enhance the user experience.