Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Immutable infrastructure:觀念與實作 (建議)

6,930 views

Published on

A talk given to JCConf 2015 on 2015/12/05.

在程式設計領域,“immutable objects” 是相當重要的設計模式。同樣的,在虛擬化及雲端時代,“immutable infrastructure” 也成為新一代的顯學。在資源及流程的充分配合下,這將會大大簡化系統的複雜度,穩定性也會大大提升。

本演講將會從觀念出發,並佐以部份實作建議,讓大家有足夠資訊來評估此架構的好處。

Video: https://youtu.be/9j008nd6-A4

Published in: Software
  • Sex in your area is here: ❤❤❤ http://bit.ly/39mQKz3 ❤❤❤
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Follow the link, new dating source: ♥♥♥ http://bit.ly/39mQKz3 ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Immutable infrastructure:觀念與實作 (建議)

  1. 1. #JCConf 
 William Yeh
  2. 2. #JCConf 
 William Yeh
  3. 3. immutable infrastructure”
  4. 4. immutable infrastructure”
  5. 5. #JCConf 
 William Yeh
  6. 6. #JCConf 
 William Yeh http://send.wtf/jcconf2015
  7. 7. #JCConf
  8. 8. im‧mutable
  9. 9. im‧mutable
  10. 10. #JCConf
  11. 11. Entropy
  12. 12. Entropy
  13. 13. #JCConf
  14. 14. #JCConf
  15. 15. Q:
  16. 16. 7% A: lysosomes
  17. 17. #JCConf
  18. 18.
  19. 19. #JCConf
  20. 20. #JCConf DNA
  21. 21. #JCConf DNA
  22. 22. #JCConf DNA lysosomes
  23. 23. #JCConf DNA lysosomes
  24. 24. #JCConf
  25. 25. How about computers?
  26. 26. Entropy ?
  27. 27. #JCConf
  28. 28. “HAProxy has been installed on Linux 2.4 systems serving millions of pages every day, and which have only known one reboot in 3 years for a complete OS upgrade.” Reliability - keeping high-traffic sites online since 2002
  29. 29. “HAProxy has been installed on Linux 2.4 systems serving millions of pages every day, and which have only known one reboot in 3 years for a complete OS upgrade.” Reliability - keeping high-traffic sites online since 2002
  30. 30. im‧mutable
  31. 31. im‧mutable
  32. 32. im‧mutable
  33. 33. im‧mutable
  34. 34. In OOP and FP, an immutable object is an object whose state cannot be modified after it is created. immutable objects JCConf 2015 Universal Scala by Walter Chang
  35. 35. In OOP and FP, an immutable object is an object whose state cannot be modified after it is created. String s = "ABC"; s.toLowerCase(); immutable objects
  36. 36. String s = "ABC"; s.toLowerCase(); Why immutable objects? • simpler to understand • inherently thread-safe • offer higher security than mutable objects. immutable objects
  37. 37. “How to sort in-place using the merge sort algorithm?” immutable objects algorithms • Too complex to be reduced to practical program. • Knuth left this as an exercise (Vol 3, 5.2.5). There do exists in-place merge sort. It must be implemented carefully. http://stackoverflow.com/q/2571049/714426
  38. 38. CTAS: Create Table As Select immutable objects algorithms • Faster than ALTER TABLE. • … with some constraints… Google it! http://stackoverflow.com/q/2571049/714426 databases
  39. 39. DHH (David Heinemeier Hansson) Creator of Rails. immutable objects algorithms databases applications
  40. 40. immutable objects algorithms http://smalltalk.xdite.net/posts/302780-bos-rewrite-from-dhh databases applications
  41. 41. immutable objects algorithms http://smalltalk.xdite.net/posts/302780-bos-rewrite-from-dhh databases applications
  42. 42. immutable infrastructure immutable objects algorithms databases applications
  43. 43. immutable infrastructure immutable objects algorithms databases applications
  44. 44. Let’s talk about immutable objects algorithms databases applications Java hot swap? hot deploy?
  45. 45. immutable objects algorithms databases applications Java hot swap since JDK 1.4
  46. 46. immutable objects algorithms databases applications Java hot swap in JRebel
  47. 47. immutable objects algorithms databases applications Java hot swap in OSGi
  48. 48. immutable objects algorithms databases applications Java Christian Posta Principal Middleware Specialist/Architect at Red Hat, open-source enthusiast, committer on Apache ActiveMQ, Apache Camel, Fabric8, HawtIO, blogging, Family, India Pale Ale. http://blog.christianposta.com/immutable/immutable-infrastructure-and-the-jvm-part-i/
  49. 49. immutable objects algorithms databases applications Java • Don’t hotdeploy/redeploy/migrate your Java services in production at runtime. Christian Posta Principal Middleware Specialist/Architect at Red Hat, open-source enthusiast, committer on Apache ActiveMQ, Apache Camel, Fabric8, HawtIO, blogging, Family, India Pale Ale. http://blog.christianposta.com/immutable/immutable-infrastructure-and-the-jvm-part-i/
  50. 50. immutable objects algorithms databases applications Java • Don’t hotdeploy/redeploy/migrate your Java services in production at runtime. • Do have a very strong focus on your delivery pipeline/automation/testing to quickly make changes to your system. Christian Posta Principal Middleware Specialist/Architect at Red Hat, open-source enthusiast, committer on Apache ActiveMQ, Apache Camel, Fabric8, HawtIO, blogging, Family, India Pale Ale. http://blog.christianposta.com/immutable/immutable-infrastructure-and-the-jvm-part-i/
  51. 51. Infra Infra
  52. 52. immutable infrastructure”
  53. 53. immutable infrastructure definition
  54. 54. http://www.slideshare.net/jpetazzo/containerization-new-virtualization- docker-separation-operational-concerns Jérôme Petazzoni definition
  55. 55. http://www.slideshare.net/jpetazzo/containerization-new-virtualization- docker-separation-operational-concerns Jérôme Petazzoni definition
  56. 56. http://www.slideshare.net/jpetazzo/containerization-new-virtualization- docker-separation-operational-concerns Jérôme Petazzoni definition
  57. 57. http://www.slideshare.net/jpetazzo/containerization-new-virtualization- docker-separation-operational-concerns Jérôme Petazzoni definition
  58. 58. WHY immutable infra?
  59. 59. WHY immutable infra? • Simplify change management • hard to keep or restore “desired state” in-place
  60. 60. WHY immutable infra? • Simplify change management • hard to keep or restore “desired state” in-place • Enforce dev/prod parity • configure & test infra before deployed to production environment
  61. 61. WHY immutable infra? • Simplify change management • hard to keep or restore “desired state” in-place • Enforce dev/prod parity • configure & test infra before deployed to production environment • Reason about apps at a higher level • … than just the deployable packages containing the code (JAR/WAR/zip/MSI/whatever)
  62. 62. WHY NOT immutable infra?
  63. 63. WHY NOT immutable infra? • Cost of “out of place” may be too high • vs
  64. 64. WHY NOT immutable infra? • Cost of “out of place” may be too high • vs • DevOps maturity level • Orchestration and
 resource allocation
 primitives
 are required
  65. 65. #JCConf
  66. 66. #JCConf
  67. 67. #JCConf
  68. 68. #JCConf
  69. 69. Golden image Phenix server
  70. 70. VM image Golden image Phenix server
  71. 71. VM image Container image Golden image Phenix server
  72. 72. VM image Container image Unikernel image Golden image Phenix server
  73. 73. VM image Container image Unikernel image • VM/IaaS provider specific • VM/IaaS provider agnostic • Ansible: https://github.com/ansible/ansible • Packer: https://www.packer.io/ • Otto: https://ottoproject.io/
  74. 74. VM image Container image Unikernel image • Docker ecosystem • docker cli • Docker Hub • CI: Jenkins, Travis CI, CircleCI… • Pre-Docker tools • Packer: https://www.packer.io/
  75. 75. VM image Container image Unikernel image
  76. 76. VM
  77. 77. VM Docker
  78. 78. Docker
  79. 79. Container per VMDocker Hyper: https://hyper.sh/
  80. 80. Container per VM Hyper: https://hyper.sh/
  81. 81. Container per VM Hyper: https://hyper.sh/ Unikernel Boxfuse: https://boxfuse.com
  82. 82. Container per VM Hyper: https://hyper.sh/ Unikernel Boxfuse: https://boxfuse.com Unikernels are constructed by using “library operating systems,” from which the developer selects only the minimal set of services required for an application to run. These sealed, fixed-purpose images run directly on a hypervisor without an intervening guest OS such as Linux.
  83. 83. Unikernel Boxfuse: https://boxfuse.com Container per VM
  84. 84. #JCConf
  85. 85. VM image Container image Unikernel image new unikernel approach
  86. 86. VM image Container image Unikernel image new unikernel approach
  87. 87. #JCConf
  88. 88. VM image Container image Unikernel image
  89. 89. VM image Container image Unikernel image
  90. 90. #JCConf
  91. 91. deployment
  92. 92. deployment
  93. 93. deployment • Rolling upgrade • Blue/green deployment • Canary deployment
  94. 94. deployment https://www.safaribooksonline.com/ library/view/continuous-delivery/ 9780134389363/
  95. 95. deployment • Cluster management • Service discovery • Orchestration
  96. 96. deployment • Pets vs cattle • Docker ecosystem is easier… • Kubernetes • Mesos • …
  97. 97. #JCConf
  98. 98. DevOps deployment
  99. 99. DevOps deployment VM image Container image Unikernel image
  100. 100. deployment VM image Container image Unikernel image DevOps IT workflow automation
  101. 101. deployment VM image Container image Unikernel image DevOps JCConf 2015, Abola Lee IT workflow automation
  102. 102. deployment VM image Container image Unikernel image DevOps JCConf 2015, Abola Lee IT workflow automation • Platform-specific tools • AWS CodeDeploy • Google Cloud Deployment Manager • IBM BlueMix
  103. 103. deployment VM image Container image Unikernel image DevOps JCConf 2015, Abola Lee IT workflow automation • Platform-specific tools • AWS CodeDeploy • Google Cloud Deployment Manager • IBM BlueMix • Ansible
  104. 104. deployment VM image Container image Unikernel image DevOps JCConf 2015, Abola Lee IT workflow automation • Platform-specific tools • AWS CodeDeploy • Google Cloud Deployment Manager • IBM BlueMix • Ansible • CI SaaS • Travis CI, CircleCI, etc.
  105. 105. deployment VM image Container image Unikernel image DevOps JCConf 2015, Abola Lee IT workflow automation • Platform-specific tools • AWS CodeDeploy • Google Cloud Deployment Manager • IBM BlueMix • Ansible • CI SaaS • Travis CI, CircleCI, etc. • Atlas (and others from HashiCorp)
  106. 106. Entropy
  107. 107. #JCConf
  108. 108. #JCConf DNA
  109. 109. #JCConf DNA
  110. 110. #JCConf DNA lysosomes
  111. 111. #JCConf DNA lysosomes
  112. 112. #JCConf VM image Container image Unikernel image
  113. 113. #JCConf VM image Container image Unikernel image
  114. 114. #JCConf deployment VM image Container image Unikernel image
  115. 115. #JCConf deployment VM image Container image Unikernel image
  116. 116. #JCConf
  117. 117. #JCConf 
 William Yeh http://send.wtf/jcconf2015

×