~/talk

Unicorn Unix Magic Tricks

Talkat ArrrrCamp 2014 · 2014-10-02..10-03· [ruby, devops-and-delivery]

Unicorn actually implements a pre-forked Ruby web server: master opens listening socket, preload-before-fork loads the Rails app so 16 workers fork in under a second, and workers inherit the socket and call select and accept. Signals adjust worker count (TTYN/TTOU) and a self-pipe trick serializes async handlers into the master loop. Hot reload uses fork then exec while passing raw file descriptors through environment variables so the new master starts serving with zero downtime.

AI-written summary · about

  1. 0:00Start
  2. 4:51Ruby and fork(2)
  3. 6:36How does Unicorn use fork(2)?
  4. 9:02Ruby and pipe (2)
  5. 9:58How does Unicorn use pipe (2)?
  6. 12:18socket lifecycle
  7. 13:27select(2)
  8. 14:02Ruby, sockets and accept(2)
  9. 16:18Unicorn and sockets
  10. 19:56Ruby and signal handling
  11. 20:49Unicorn and signals
  12. 24:44Scaling workers with signals
  13. 28:00Hot Reload - #reexec
  14. 32:59That's why!
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.