Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

/ @hpoom About me Associate Director of Architecture & Engineering Holiday Extras Simon Wood 2

Slide 3

Slide 3 text

@hpoom We are building the future of travel

Slide 4

Slide 4 text

@hpoom

Slide 5

Slide 5 text

@hpoom

Slide 6

Slide 6 text

/ @hpoom 6 Shortbreaks

Slide 7

Slide 7 text

/ @hpoom Node JS 7 Micro services Q&A What I am going to cover

Slide 8

Slide 8 text

@hpoom 8 "JavaScript: Good Parts vs. The Rest" by Nathan Smith. Licensed under Creative Commons.- https://flic.kr/p/8aGB5o

Slide 9

Slide 9 text

@hpoom 9 Math.min() < Math.max(); // false typeof NaN; // “number” typeof null; // ”object” null instanceof Object; // false 0.1 + 0.2 == 0.3; // false

Slide 10

Slide 10 text

@hpoom 10

Slide 11

Slide 11 text

@hpoom Javascript The Language 11

Slide 12

Slide 12 text

@hpoom popularity 12

Slide 13

Slide 13 text

@hpoom 13

Slide 14

Slide 14 text

@hpoom 14

Slide 15

Slide 15 text

@hpoom Wide use cases 15

Slide 16

Slide 16 text

@hpoom standards 16

Slide 17

Slide 17 text

@hpoom 17

Slide 18

Slide 18 text

/ @hpoom Can I use caniuse.com

Slide 19

Slide 19 text

/ @hpoom Node Green node.green

Slide 20

Slide 20 text

@hpoom Server Side Javascript 20

Slide 21

Slide 21 text

@hpoom Node JS 21

Slide 22

Slide 22 text

@hpoom 22

Slide 23

Slide 23 text

@hpoom 23

Slide 24

Slide 24 text

@hpoom Why Choose Node JS 24

Slide 25

Slide 25 text

@hpoom Full Stack Javascript 25

Slide 26

Slide 26 text

@hpoom Event Driven 26

Slide 27

Slide 27 text

@hpoom 27

Slide 28

Slide 28 text

@hpoom Hell 28 Callback

Slide 29

Slide 29 text

@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){ ... }); }); }); }); }); });

Slide 30

Slide 30 text

@hpoom Promises 30

Slide 31

Slide 31 text

@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();

Slide 32

Slide 32 text

@hpoom HTTP baked in 32

Slide 33

Slide 33 text

@hpoom NPM 33

Slide 34

Slide 34 text

@hpoom 34 www.modulecounts.com

Slide 35

Slide 35 text

@hpoom Front End Tooling 35

Slide 36

Slide 36 text

@hpoom Challenges 36

Slide 37

Slide 37 text

@hpoom Single Instance 37

Slide 38

Slide 38 text

@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);

Slide 39

Slide 39 text

@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

Slide 40

Slide 40 text

@hpoom Exit On Error 40

Slide 41

Slide 41 text

@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.

Slide 42

Slide 42 text

@hpoom Single Threaded 42

Slide 43

Slide 43 text

/ @hpoom PM2 pm2.keymetrics.io

Slide 44

Slide 44 text

@hpoom No Web Server 44

Slide 45

Slide 45 text

@hpoom Memory Management 45

Slide 46

Slide 46 text

@hpoom 46

Slide 47

Slide 47 text

@hpoom 47

Slide 48

Slide 48 text

@hpoom IO js 48

Slide 49

Slide 49 text

@hpoom 49

Slide 50

Slide 50 text

@hpoom 50

Slide 51

Slide 51 text

@hpoom Questions? please contact me if you have any questions Twitter: @hpoom logo 51 By Simon Wood

Slide 52

Slide 52 text

@hpoom What are Microservices 52

Slide 53

Slide 53 text

” @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

Slide 54

Slide 54 text

@hpoom How small is micro? 54

Slide 55

Slide 55 text

@hpoom Single Responsibility 55

Slide 56

Slide 56 text

@hpoom Growing Popular 56

Slide 57

Slide 57 text

@hpoom 57

Slide 58

Slide 58 text

@hpoom Pros Cons 58 &

Slide 59

Slide 59 text

/ @hpoom pros 59 • Independently Scaleable • High Testability • Technology Diversity • Independently Deployable • Less People Dependency

Slide 60

Slide 60 text

/ @hpoom cons 60 • Increased Complexity • Operational Challenges • Performance Hit • Eventual Consistency • Service Discovery Essential

Slide 61

Slide 61 text

/ @hpoom When to use 61 https://www.martinfowler.com/bliki/MicroservicePremium.html

Slide 62

Slide 62 text

/ @hpoom When not to use 62

Slide 63

Slide 63 text

@hpoom Why? 63

Slide 64

Slide 64 text

@hpoom Engineering Culture 64

Slide 65

Slide 65 text

” @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

Slide 66

Slide 66 text

@hpoom 66

Slide 67

Slide 67 text

@hpoom 67

Slide 68

Slide 68 text

” @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

Slide 69

Slide 69 text

/ @hpoom benefit of pods 69 • Autonomous • Simpler Communications • Fully Accountable • Velocity

Slide 70

Slide 70 text

@hpoom Micro Modules 70

Slide 71

Slide 71 text

@hpoom 71

Slide 72

Slide 72 text

@hpoom Don’t fly blind 72

Slide 73

Slide 73 text

” @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

Slide 74

Slide 74 text

@hpoom Cloud based logging ROCKS 74

Slide 75

Slide 75 text

/ @hpoom Sumo Logic sumologic.com Cloud logging solutions 75 Logstash elastic.co/products/logstash Loggly loggly.com

Slide 76

Slide 76 text

@hpoom 76

Slide 77

Slide 77 text

@hpoom 77

Slide 78

Slide 78 text

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

Slide 79

Slide 79 text

@hpoom Metrics are Essential 79

Slide 80

Slide 80 text

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

Slide 81

Slide 81 text

@hpoom 81

Slide 82

Slide 82 text

@hpoom 82

Slide 83

Slide 83 text

/ @hpoom Chat Ops 83

Slide 84

Slide 84 text

@hpoom Deployment Friction 84

Slide 85

Slide 85 text

/ @hpoom Heroku heroku.com

Slide 86

Slide 86 text

” @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

Slide 87

Slide 87 text

/ @hpoom Docker docker.com

Slide 88

Slide 88 text

/ @hpoom Convox convox.com

Slide 89

Slide 89 text

@hpoom Site reliability engineering 89

Slide 90

Slide 90 text

@hpoom Infrastructure as Code 90

Slide 91

Slide 91 text

@hpoom Automate All the things 91

Slide 92

Slide 92 text

@hpoom APIs 92 Aggregate

Slide 93

Slide 93 text

@hpoom 93 Website Mobile App Affiliates

Slide 94

Slide 94 text

@hpoom 94 Website Mobile App Affiliates API

Slide 95

Slide 95 text

@hpoom 95 Website Mobile App Affiliates API Cache

Slide 96

Slide 96 text

/ @hpoom GraphQL graphql.org

Slide 97

Slide 97 text

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

Slide 98

Slide 98 text

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

Slide 99

Slide 99 text

@hpoom 99

Slide 100

Slide 100 text

/ @hpoom backends for frontENDs 100

Slide 101

Slide 101 text

@hpoom Tooling is Essential 101

Slide 102

Slide 102 text

@hpoom Developer Experience 102

Slide 103

Slide 103 text

” @hpoom We want to empower our engineers to deliver software consistently, reliably and with minimal friction. Uber

Slide 104

Slide 104 text

@hpoom 104

Slide 105

Slide 105 text

@hpoom 105

Slide 106

Slide 106 text

@hpoom 106

Slide 107

Slide 107 text

/ @hpoom GRPC grpc.io

Slide 108

Slide 108 text

@hpoom Data 108

Slide 109

Slide 109 text

” @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

Slide 110

Slide 110 text

/ @hpoom Data Pipeline concept 110

Slide 111

Slide 111 text

/ @hpoom Snowplow snowplowanalytics.com

Slide 112

Slide 112 text

@hpoom Where are we heading next 112

Slide 113

Slide 113 text

@hpoom 113 We are Hiring!

Slide 114

Slide 114 text

@hpoom Thank you please contact me if you have any questions Twitter: @hpoom logo 114 By Simon Wood