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

About Deploying and Process Management for Slimane

About Deploying and Process Management for Slimane

2016 Jun 27 Tokyo server side swift meetup


Yuki Takei

June 28, 2016


  1. Y U K I TA K E I A b

    o u t D e p l o y i n g a n d P ro c e s s M a n a g e m e n t f o r S l i m a n e 2 0 1 6 J U N 2 7 T O K Y O S E R V E R S I D E S W I F T M E E T U P
  2. Hello! I’m Yuki Takei

  3. None
  4. None
  5. • 100% asynchronous(built over libuv) • Express(Node.js) inspired • Stand

    Alone HTTP Server • Moduler • Faster • Adopts Open-Swift • Supports Multiprocess Environment Slimane is a Web Framework/HTTP Server for Swift3
  6. • Routing/Middleware • Session • JSON • Hash Functions •

    Redis • WebSocket • View/Template Engine • Promise • Future Available functionalities(Modules) And more…. https://github.com/slimane-swift
  7. S w i f t y - L i b

    u v S U V S K E LT O N S L I M A N E Layer of Slimane OS App libuvͷSwiftόΠϯσΟϯά ඇಉظωοτϫʔΫϓϥοτϑΥʔϜ TCPɺUDPɺProcessɺ FIleSystemɺDNS etc… SuvϕʔεͷHTTPαʔόʔ HTTPϓϩτίϧͷύʔζ ΞϓϦέʔγϣϯϑϨʔϜϫʔΫ system callɺevent loop
  8. Today I’ll show you a first step of deploying and

    process management for Slimane
  9. Anyways

  10. How do you deploy your application?

  11. How do you restart your application?

  12. • Blue Green Deployment • Cloud Services provided • Capistrano(with

    SCM) • Rsync There are some major deploying ways
  13. Blue Green Deployment (Immutable infrastructure)

  14. Blue Green Deployment (Immutable infrastructure) No Down Time!

  15. Cloud Service Provided

  16. Cloud Service Provided No Down Time!(Probably..)

  17. Capistrano or rsync access distribute changes

  18. Capistrano or rsync access distribute changes Have to restart

  19. Capistrano or rsync access distribute changes Has Down Time!

  20. There should not be down time on our services

  21. So we have to choose Blue Green Deployment or Cloud

    services provided one?
  22. We Should!

  23. But.. wait

  24. It’s not necessarily for all projects.

  25. Should depends on the project size, money, people and phase

  26. Well, what should we do?

  27. Graceful Restart

  28. access master process child processes(fork) distribute changes What is Graceful

  29. access master process folk new children (old processes) kill gradually

    What is Graceful Restart?
  30. access master process folk new children (old processes) kill gradually

    What is Graceful Restart?
  31. access master process folk new children kill gradually No Down

    Time! What is Graceful Restart?
  32. • Nginx • Apache • Unicorn(Rack HTTP Server) • PM2(Node.js)

    Major Servers/Tools that supports `Graceful Restart`
  33. How about Slimane(Swift)?

  34. None
  35. • Use via Command line interface • Controllable by signals

    • Observing workers(like a supervisor) • Can take cpu/memory usage from each workers • Will merge to Skelton partially (it means Skelton’ll become like a Unicorn) PMS is a process manger for apps that are built over Skelton
  36. (But super early…)

  37. Demo

  38. • USR2 (Gracefully restart all workers) • USR1 (Reopen log

    files) • TTIN (Increase a worker process) • TTOU (Decrease a worker process) • INT/TERM(exit immediately) Supported signals(2016-06-27)
  39. Thanks!