microservice architecture 바로 알기

Download Microservice architecture 바로 알기

Post on 15-Aug-2015

1.113 views

Category:

Software

10 download

Embed Size (px)

TRANSCRIPT

  1. 1. /114 Microservice architecture () ? gunlee01@gmail.com http://facebook.com/gunlee01 1
  2. 2. /114 .. 2 Slidesahre, Facebook, , . ... . ...... ... , CI/CD , DDD, .. Micro service architecture . ^^; ~~~ +_+
  3. 3. /114 Microservice architecture 3
  4. 4. /114 Microservice architecture ? Ref. http://eugenedvorkin.com/seven-micro-services-architecture-advantages/ 4
  5. 5. /114 Microservice architecture ? Ref. http://martinfowler.com/articles/microservices.html5
  6. 6. /114 Microservice architecture MSA ... ... ... Vendor SOA ... .... Bla bla... 6
  7. 7. /114 Microservice architecture ~ . 7
  8. 8. /114 Microservice architecture ~ . ? 8
  9. 9. /114 Key benefits 1)Technology Heterogeneity 9
  10. 10. /114 Key benefits 1)Technology Heterogeneity Ref. Building Microservices Designing Fine-Grained Systems / By Sam Newman / OReilly Media10
  11. 11. /114 Key benefits 1)Technology Heterogeneity Ref. Building Microservices Designing Fine-Grained Systems / By Sam Newman / OReilly Media Time to Market 11
  12. 12. /114 Key benefits 2)Optimizing for Replaceability 12
  13. 13. /114 Key benefits 2)Optimizing for Replaceability - Small size, small risk 13
  14. 14. /114 Key benefits 2)Optimizing for Replaceability - Small size, small risk - Too big, too risky ! 14
  15. 15. /114 Key benefits 2)Optimizing for Replaceability - Small size, small risk - Too big, too risky ! ... ! . 15
  16. 16. /114 Key benefits 2)Optimizing for Replaceability - Small size, small risk - Too big, too risky ! ! 16
  17. 17. /114 Key benefits 3)Resilience 17
  18. 18. /114 Key benefits 3)Resilience A service fails, Everything stops working 18
  19. 19. /114 Key benefits 3)Resilience A service fails, Everything stop workingA service fails, the service stops working 19
  20. 20. /114 Key benefits 4)Scailing 20
  21. 21. /114 Key benefits 4)Scailing 21
  22. 22. /114 Key benefits 4)Scailing We have to scale everything together. 22
  23. 23. /114 Key benefits 4)Scailing Scaling at just those microservices that need it Ref. Building Microservices Designing Fine-Grained Systems / By Sam Newman / OReilly Media Biz 23
  24. 24. /114 Key benefits & Ease of Deployment Organizational Alignment Composability 24
  25. 25. /114 Key benefits & more Simple 25
  26. 26. /114 Key benefits ! 26
  27. 27. /114 Key benefits But... 27
  28. 28. /114 But But... MSA is no free lunch or silver bullet. 28
  29. 29. /114 But Complexities of distributed systems Scaling MSA (/) - . 29
  30. 30. /114 But Complexities of distributed systems Fallacies of distributed computing 30
  31. 31. /114 But Complexities of distributed systems Fallacies of distributed computing The network is reliable. Latency is zero. Bandwidth is infinite. The network is secure. Transport cost is zero. ... Ref. http://en.wikipedia.org/wiki/Fallacies_of_distributed_computing31
  32. 32. /114 But Complexities of distributed systems ? ? ? ? ... 32
  33. 33. /114 But Ref. Dante And Virgil In Hell (1850) / by William-Adolphe Bouguereau (1825-1905) Complexities of distributed systems Hell ~~! 33
  34. 34. /114 Basic Strategies ! 34
  35. 35. /114 Basic Strategies Scaling Scaling Database Caching Asynchronous 35 Basic Strategies for MSA
  36. 36. /114 Basic Strategies 1)Scaling 36
  37. 37. /114 Basic Strategies 1)Scaling Splitting 37 POST Friends Pictures
  38. 38. /114 Basic Strategies 1)Scaling 38 Splitting Spreading
  39. 39. /114 Basic Strategies 1)Scaling 39 Splitting Spreading Load balancing Ref. Building Microservices Designing Fine-Grained Systems / By Sam Newman / OReilly Media Customer Service Instance 1 Load balancer Customer Service Instance 2 Customer Service Instance 3
  40. 40. /114 Basic Strategies 1)Scaling 40 Splitting Spreading Load balancing Worker based Customer Service Worker1 Customer Service Worker2 Customer Service Worker3 dispatcher Queue
  41. 41. /114 Basic Strategies 2)Scaling Database 41
  42. 42. /114 Basic Strategies 2)Scaling Database Scaling for read 42 Ref. Building Microservices Designing Fine-Grained Systems / By Sam Newman / OReilly Media Replication
  43. 43. /114 Basic Strategies 2)Scaling Database Scaling for read 43 Ref. Building Microservices Designing Fine-Grained Systems / By Sam Newman / OReilly Media
  44. 44. /114 Basic Strategies 2)Scaling Database Scaling for read 44 CP? AP ?
  45. 45. /114 Basic Strategies 2)Scaling Database Scaling for read 45 Ref. Building Microservices Designing Fine-Grained Systems / By Sam Newman / OReilly Media Sacrificing availability Sacrificing Consistency - BASE CP? AP ?
  46. 46. /114 Basic Strategies 2)Scaling Database Scaling for read Scaling for write 46 1 4 7 2 5 8 3 6 9 Sharding Customer Customer Customer
  47. 47. /114 Basic Strategies 2)Scaling Database Scaling for read Scaling for write 47 1 4 7 2 5 8 3 6 9 Sharding Customer Customer Customer Shard Key ? Rebalancing ?
  48. 48. /114 Basic Strategies 2)Scaling Database Scaling for read Scaling for write 48 Sharding & replication
  49. 49. /114 Basic Strategies 2)Scaling Database 49 Products... NoSQLs.... & NHN Cubrid shard Twitter Gizzard Spoke Proxy Spider storage Engine CONNECT storage Engine
  50. 50. /114 Basic Strategies 3)Caching 50
  51. 51. /114 Basic Strategies 3)Caching 51 Performance optimization
  52. 52. /114 Basic Strategies 3)Caching 52 Performance A RAM is faster than a HDD ! Client Memory (Cache) Disk (origin) 1)Request for cache entry 2)on cache miss, Get fresh data from the origin 3)Update cache entry
  53. 53. /114 Basic Strategies 3)Caching 53 Local Cache Global cache Distributed cache Cache Cache Cache Cache Cache Cache Cache
  54. 54. /114 Basic Strategies 3)Caching 54 Performance, , DB ...
  55. 55. /114 Basic Strategies 3)Caching 55 Performance, , DB ... !!! Cache DB ...
  56. 56. /114 Basic Strategies 3)Caching 56 How to hide the origin Client Cache Origin (DB or others) Sync. Request for cache entry Async. Event fired in event of cache miss update Fail fast on cache miss
  57. 57. /114 Basic Strategies 3)Caching 57 Products... Redis Memcached Redis Cluster Infinispan Hazelcast Coherence
  58. 58. /114 Basic Strategies 4)Asynchronous 58
  59. 59. /114 Basic Strategies 4)Asynchronous 59 ? Ref. http://www.eaipatterns.com/ramblings/18_starbucks.html / Gregor Hohpe Starbuks Does Not Use 2PC. - Hotto Cocoa o Kudasai.
  60. 60. /114 Basic Strategies 4)Asynchronous 60
  61. 61. /114 Basic Strategies 4)Asynchronous 61 ?
  62. 62. /114 Basic Strategies 4)Asynchronous 62 ? . - , ... Loosely Coupled !
  63. 63. /114 Basic Strategies 4)Asynchronous 63 ? . - ... Resilience !
  64. 64. /114 Basic Strategies 4)Asynchronous 64 ? .. - ... - ... Performance !
  65. 65. /114 Basic Strategies 4)Asynchronous 65 Loosely coupled Resilience Performance Client Service Worker Worker Worker Message Queue
  66. 66. /114 Basic Strategies 4)Asynchronous 66 Orchestration vs Choreography vs
  67. 67. /114 Basic Strategies 4)Asynchronous 67 Orchestration vs Choreography Choreographed approach is more loosely coupled, flexible and amenable to change.
  68. 68. /114 Basic Strategies 4)Asynchronous 68 Orchestration vs Choreography Orchestration Ref. Building Microservices Designing Fine-Grained Systems / By Sam Newman / OReilly Media
  69. 69. /114 Basic Strategies 4)Asynchronous 69 Orchestration vs Choreography Choreography Ref. Building Microservices Designing Fine-Grained Systems / By Sam Newman / OReilly Media
  70. 70. /114 Basic Strategies Scaling Scaling Database Caching Asynchronous 70 Basic Strategies for MSA
  71. 71. /114 Real World 71 ?
  72. 72. /114 Real World 72
  73. 73. /114 Real World 1)Dynamic Service Registry 73
  74. 74. /114 Real World 1)Dynamic Service Registry 74 Service discovery Health check between instances Service versioning
  75. 75. /114 Real World 1)Dynamic Service Registry 75 Client Service Registry Service A Where is the service A? Service Service Service Service Service Service Service Im here. Im alive! OK
  76. 76. /114 Real World 1)Dynamic Service Registry 76 Zookeeper Apache Consul Eureka Netflix
  77. 77. /114 Real World 2)Antifragile 77 A resilience is free? Absolutely Not!
  78. 78. /114 Real World 2)Antifragile 78 Cascading failure Ref. https://github.com/Netflix/Hystrix/wiki
  79. 79. /114 Real World 2)Antifragile 79 Ref. https://github.com/Netflix/Hystrix/wiki Cascading failure
  80. 80. /114 Real World 2)Antifragile 80 Ref. https://github.com/Netflix/Hystrix/wiki Cascading failure
  81. 81. /114 Real World 2)Antifragile 81 Bulkhead Cascading failure
  82. 82. /114 Real World 2)Antifragile 82 Timeout Client Servicerequest over N/W Wait for some seconds Check time out Do failure scenarios Cascading failure
  83. 83. /114 Real World 2)Antifragile 83 Throttle & quick failure Client Servicerequest over N/W Quick failure (if exceed max allowed req.) Cascading failure
  84. 84. /114 Real World 2)Antifragile 84 Retry Client Servicerequest over N/W If error or timeout, Retry Cascading failure
  85. 85. /114 Real World 2)Antifragile 85 Idempotency Cascading failure Ref. https://github.com/Netflix/Hystrix/wiki
  86. 86. /114 Real World 2)Antifragile 86 Circuit breaker Cascading failure Ref. https://github.com/Netflix/Hystrix/wiki