20
Building simple Node.js Microservices using Hapi and Redis Jeff Barczewski codewinds.com

Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Embed Size (px)

Citation preview

Page 1: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Building simple Node.jsMicroservices using Hapi and

RedisJeff Barczewski

codewinds.com

CodeWindsTraining

Page 2: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Building simple Node.jsMicroservices using Hapi and

Redis

slides, code, resources, notes@jeffbski and @[email protected]

codewinds.com/nc2015

Page 3: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Who is Jeff Barczewski?CodeWinds Online Training26 yrs Software EngineerUSAF, RGA, Elsevier, MasterCard@jeffbski [email protected]

Page 4: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Story of a monolithLarge highly coupled codebaseStuck on old technologyMinimal testsLimited documentationSiloed knowledge

Page 5: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Story of a monolith - p2Slow feature cycle timeCustom forks for clientsHard to scaleDefects and regressions

Page 6: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Learning from HistoryDo One Thing and Do It Well - Unix

Piping data between programsSOA w/ESB, Soap - complexityREST - simplicity

Credits: by - Avatar Surfing On Soap Bar schoschie CC BY-SA 2.0

Page 7: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Requirements ChangeReal-time web/apps - pushWeb for transactions, RPC style

large number of small resourcesdynamic tuning of data by deviceFalcorJS w/JSON GraphRelay w/GraphQL

Page 8: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

MicroservicesAka: fine grained SOA, Replaceable ComponentArchitectureTerm emerged for this style architecture 2011-2012Many opinions

Page 9: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Microservices (MSA)Architectural style that generallyutilizes small focused processescommunicating over lightweight

means

Page 10: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Microservice BenefitsIndependently deployable, replaceable,upgradeableElastic and scalableAllows disparate programming languages andtechnology (db)Managed by different teams

Page 11: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Microservice Benefits - p2Can enable resiliencyComposable - caching, aggregation,proxies, gatewaysAllows fine grained monitoring andresource tuning

Page 12: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Microservice RisksDecomposing w/o domain knowledgeSiloed knowledge / skillsRapid change vs qualityDeploy / log complexityVersion compatibility

Page 13: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Does it work?

Page 14: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Monolith to MicroservicesNetflix - 37% web bandwidth peak, 1B APIcalls/day, 6 services/callAmazon - 100-150 service calls per web pageEbay - split over 75 business functional areas

Page 15: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Microservice OptimismMicroservices are becoming the

default style for building enterpriseapplications.

Page 16: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Balance Risk vs RewardEvolve architectureAutomate deployment, logmanagement, and monitoringResilient designPlan for scalability (human and hardware)

Page 17: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Evolving ArchitectureDecomposition - Functions, ModulesRedis Queue - Mail serviceRedis Reliable QueueRedis Cache - Ad generator

Page 18: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Evolving Architecture - p2Hapi API Gateway - ProxyHapi MicroserviceHapi API Gateway - EnhancedHapi Microservice using plugin

Page 19: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Going BeyondFrameworks - SenecaJSMessaging - KafkaStream services - AWS LambdaDynamic scaling / deploy -Kubernetes

Page 20: Building simple Node.js Microservices using Hapi and · PDF fileBuilding simple Node.js Microservices using Hapi and ... w Ý Building simple Node.js Microservices using Hapi and Redis

Resources

slides, code, resources, notes@jeffbski and @[email protected]

codewinds.com/nc2015