Node.js & Microservices

Node.js & Microservices

Part One
Javascript, a love/hate language for some. It is our only choice for client side programming which has has seen a rise in recent years, but JavaScript is also a successful server side language too. Simon will cover why the asynchronous nature of Node.js works well server side and the strengths and weaknesses of Node.js as a choice for building large scale solutions.

Part Two
Microservices are a hot topic among the silicon valley startups, but why are we seeing Uber, Netflix and others turn their backs on monolithic web applications and turn to microservices as a solution? Simon will talk about the journey Holiday Extras are undergoing in moving from a single large server side e-commerce solution to small single responsibility services. He will explain why Holiday Extras believe this is the right route to take, and the challenges we have faced so far on this journey.

39bb8762f3a25ebc00ebd75bc4f363af?s=128

Simon Wood

April 06, 2017
Tweet

Transcript

  1. @hpoom Node JS & Microservices By Simon Wood 1 tech.holidayextras.co.uk

  2. / @hpoom About me Associate Director of Architecture & Engineering

    Holiday Extras Simon Wood 2
  3. @hpoom We are building the future of travel

  4. @hpoom

  5. @hpoom

  6. / @hpoom 6 Shortbreaks

  7. / @hpoom Node JS 7 Micro services Q&A What I

    am going to cover
  8. @hpoom 8 "JavaScript: Good Parts vs. The Rest" by Nathan

    Smith. Licensed under Creative Commons.- https://flic.kr/p/8aGB5o
  9. @hpoom 9 Math.min() < Math.max(); // false typeof NaN; //

    “number” typeof null; // ”object” null instanceof Object; // false 0.1 + 0.2 == 0.3; // false
  10. @hpoom 10

  11. @hpoom Javascript The Language 11

  12. @hpoom popularity 12

  13. @hpoom 13

  14. @hpoom 14

  15. @hpoom Wide use cases 15

  16. @hpoom standards 16

  17. @hpoom 17

  18. / @hpoom Can I use caniuse.com

  19. / @hpoom Node Green node.green

  20. @hpoom Server Side Javascript 20

  21. @hpoom Node JS 21

  22. @hpoom 22

  23. @hpoom 23

  24. @hpoom Why Choose Node JS 24

  25. @hpoom Full Stack Javascript 25

  26. @hpoom Event Driven 26

  27. @hpoom 27

  28. @hpoom Hell 28 Callback

  29. @hpoom 29 getData(function(a){ getMoreData(a, function(b){ getMoreData(b, function(c){ getMoreData(c, function(d){ getMoreData(d,

    function(e){ getMoreData(e, function(f){ ... }); }); }); }); }); });
  30. @hpoom Promises 30

  31. @hpoom 31 asyncCall().then(function(data1){ // do something... return anotherAsyncCall(); }).then(function(data2){ //

    do something... return oneMoreAsyncCall(); }).then(function(data3){ // the third and final async response }).fail(function(err) { // handle any error from any of the above calls }).done();
  32. @hpoom HTTP baked in 32

  33. @hpoom NPM 33

  34. @hpoom 34 www.modulecounts.com

  35. @hpoom Front End Tooling 35

  36. @hpoom Challenges 36

  37. @hpoom Single Instance 37

  38. @hpoom 38 var express = require('express'); var app = express();

    var globalCount = 0; app.get('/', function (req, res) { var localCount = 0; globalCount++; localCount++; res.send('You visited #' + localCount + ' times! Total visits #' + globalCount); }); app.listen(8080);
  39. @hpoom 39 You visited #1 times! Total visits #1 You

    visited #1 times! Total visits #2 You visited #1 times! Total visits #3 You visited #1 times! Total visits #4 You visited #1 times! Total visits #5
  40. @hpoom Exit On Error 40

  41. @hpoom 41 1.Close the server to stop accepting new connections.

    2.Wait for existing connections to finish and close normally. 3.Only exit the process once all clients have finished and disconnected happily. 4.Failsafe: before starting the shutdown, it’s advisable to set an exit time limit. If the shutdown hangs or takes too long, something else is probably wrong so exit the process anyway.
  42. @hpoom Single Threaded 42

  43. / @hpoom PM2 pm2.keymetrics.io

  44. @hpoom No Web Server 44

  45. @hpoom Memory Management 45

  46. @hpoom 46

  47. @hpoom 47

  48. @hpoom IO js 48

  49. @hpoom 49

  50. @hpoom 50

  51. @hpoom Questions? please contact me if you have any questions

    Twitter: @hpoom logo 51 By Simon Wood
  52. @hpoom What are Microservices 52

  53. ” @hpoom Small Autonomous services that work together, modelled around

    a business domain. Sam Newman "Sam Newman" by Gavin Bell. Licensed under Creative Commons.- https://flic.kr/p/LEwhq
  54. @hpoom How small is micro? 54

  55. @hpoom Single Responsibility 55

  56. @hpoom Growing Popular 56

  57. @hpoom 57

  58. @hpoom Pros Cons 58 &

  59. / @hpoom pros 59 • Independently Scaleable • High Testability

    • Technology Diversity • Independently Deployable • Less People Dependency
  60. / @hpoom cons 60 • Increased Complexity • Operational Challenges

    • Performance Hit • Eventual Consistency • Service Discovery Essential
  61. / @hpoom When to use 61 https://www.martinfowler.com/bliki/MicroservicePremium.html

  62. / @hpoom When not to use 62

  63. @hpoom Why? 63

  64. @hpoom Engineering Culture 64

  65. ” @hpoom Any organization that designs a system … will

    inevitably produce a design whose structure is a copy of the organization's communication structure. Melvin Conway
  66. @hpoom 66

  67. @hpoom 67

  68. ” @hpoom If you can’t feed a team with two

    pizzas, it’s too large. Jeff Bezos "Etech05: Jeff" by James Duncan Davidson. Licensed under Creative Commons.- https://flic.kr/p/zYCD
  69. / @hpoom benefit of pods 69 • Autonomous • Simpler

    Communications • Fully Accountable • Velocity
  70. @hpoom Micro Modules 70

  71. @hpoom 71

  72. @hpoom Don’t fly blind 72

  73. ” @hpoom If Engineering at Etsy has a religion, it’s

    the Church of Graphs. If it moves, we track it. Sometimes we’ll draw a graph of something that isn’t moving yet, just in case it decides to make a run for it. Code as Craft "Etsy" by KnitSpirit. Licensed under Creative Commons.- https://flic.kr/p/btwyFm
  74. @hpoom Cloud based logging ROCKS 74

  75. / @hpoom Sumo Logic sumologic.com Cloud logging solutions 75 Logstash

    elastic.co/products/logstash Loggly loggly.com
  76. @hpoom 76

  77. @hpoom 77

  78. / @hpoom Correlation ids 78 Website API Create ID: xyz8942

    xyz8942 xyz8942 xyz8942 xyz8942 xyz8942
  79. @hpoom Metrics are Essential 79

  80. / @hpoom Nagios nagios.org Cloud metrics solutions 80 Graphite graphiteapp.org

    Prometheus prometheus.io
  81. @hpoom 81

  82. @hpoom 82

  83. / @hpoom Chat Ops 83

  84. @hpoom Deployment Friction 84

  85. / @hpoom Heroku heroku.com

  86. ” @hpoom We want to empower developers to repeatedly deploy

    fast and often at scale. Removing the need for IT Infrastructure setup to get code into production. Andy Britcliffe
  87. / @hpoom Docker docker.com

  88. / @hpoom Convox convox.com

  89. @hpoom Site reliability engineering 89

  90. @hpoom Infrastructure as Code 90

  91. @hpoom Automate All the things 91

  92. @hpoom APIs 92 Aggregate

  93. @hpoom 93 Website Mobile App Affiliates

  94. @hpoom 94 Website Mobile App Affiliates API

  95. @hpoom 95 Website Mobile App Affiliates API Cache

  96. / @hpoom GraphQL graphql.org

  97. / @hpoom Size: 162KB Content Download: 268ms 97

  98. / @hpoom Size: 76KB Content Download: 214ms 98

  99. @hpoom 99

  100. / @hpoom backends for frontENDs 100

  101. @hpoom Tooling is Essential 101

  102. @hpoom Developer Experience 102

  103. ” @hpoom We want to empower our engineers to deliver

    software consistently, reliably and with minimal friction. Uber
  104. @hpoom 104

  105. @hpoom 105

  106. @hpoom 106

  107. / @hpoom GRPC grpc.io

  108. @hpoom Data 108

  109. ” @hpoom When stitched together and analysed appropriately, a deluge

    of data suddenly becomes actionable knowledge and insight that marketers can act upon to maintain a personal connection with their customers. Lisa Gilbert "Virginia Tech - data center" by Christopher Bowns. Licensed under Creative Commons.- https://flic.kr/p/4Fnm8M
  110. / @hpoom Data Pipeline concept 110

  111. / @hpoom Snowplow snowplowanalytics.com

  112. @hpoom Where are we heading next 112

  113. @hpoom 113 We are Hiring!

  114. @hpoom Thank you please contact me if you have any

    questions Twitter: @hpoom logo 114 By Simon Wood