microservice intro
Post on 16-Apr-2017
139 views
Embed Size (px)
TRANSCRIPT
Ops Technology
MicroservicesEvolution of middleware
Ramesh KumarSenior web Developer
Todays AgendaMonolithic SystemMircoservice and its Charecteristics?Microservice AchitectureLegacy SystemsMonolitic SystemsSOA Monolithic vs MicroserviceAdvantage & Disadvantage.Benefits of MicroservicesExamplesTakeawayQ&A
Monolithic ArchitectureA monolithic application is self-contained, and independent from other computing applications. The design philosophy is that the application is responsible not just for a particular task, but can perform every step needed to complete a particular function.Complete task, end to endWork togetherNo ModularityReuse of parts of the application logicMaintenance by allowing repair or replacement of parts
Basic Monolithic enterprise application
ExamplesMost programs you deal with day-to-day word processing, spreadsheets , powerpoint e-mail (?) development environments Compilers many gamesLarge, corporate batch systems payrollreports astounding number of very large mainframe
CharacteristicsUsually written in a single programming language. Everything compiled and linked into a single (monolithic) application May operate in both batch and GUI Data load into memory write all back on explicit save No simultaneous data sharing May have concurrency multi-threading multi-processing (but only one executable)
Advantages Performance Reading and writing of data can be optimized for performance without regard to issues such as multi-user data sharing. read data directly from the disk via file system read data less directly from the disk via layers of intervening software (e.g., RDBMS, OODBMS, distributed data server). modifying data neednt worry about writers in other address spaces. In-memory is massively quicker Caching would present many subtle issues for shared data systems No IPC overhead Simplicity less code to write fewer issues to deal with locking, transactions, integrity, performance, geographic distribution
DisadvantagesLack of support for shared access, forces one-at-a-time access Mitigate: allowing datasets that merge multiple files hybrid approaches complex monolithic analysis software simple data client/server update software Quantity of datawhen quantity of data is too large to load into memorytoo much time to load too much virtual memory used Depending on which is possible sequential access (lock db or shadow db) selective access
Some Definitions...Microservices are small, autonomous services that work together.
The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms.
A typically referenced guideline is the Two-Pizza Team rule, which states if you cannot feed the team building a microservice with two pizzas, your microservice is too big.
What is Microservice?Each service is loosely coupled / independently deployable.Changes made only to this service.Each service has a bounded context.Service should not know about surrounding service.Remotely accessible service (typically http).Does one thing (and does it well?).Executes stand alone in a container (JVM - in this case).Can be composed into a larger service.
ChallengesScaling monolithic applications is challenging as we have just one degree of freedom to scale outThe same challenge applies to replicationInnovation is constrained by the fact that we cannot easily mix different technologies for implementing the various functionalitiesIncremental Change is constrained by the fact that cant incrementally deploy new functionalities . We needto redeploy an entire subsystem.Loose Coupling and High Cohesion are harder to achieve and especially to preserve as the barriers between functionalities are very thin
Why not monolithic?Development PhaseApps grow (teams grow too!)Different parts change at different rates.Different execution container needs (resources)Different teams?Company grows?Deployment PhaseDeploying a change to a microservice does notIncrease blood pressure as much as deploying theONE MASSIVE APP THAT RUNS EVERYTHINGFear of deploying a change.Risk of trying a new technique, new framework.
Why Microservices?
CharacteristicsServicesProducts vs ProjectsSmart endpoints / dumb pipesDecentralized governanceDecentralised data managementAutomationDesign for failureEvolutionary design
Microservice ArchitecturesIndividual functionalities become unit of deployment and run in their own process
Microservices communicate through some lightweight mechanism.
Monolithic vs. MircoserviceA monolithic applications merges multiple functionalities in the same executable.
AdvantagesSmall code base / easier to test / maintainEasy to scale - cloneEasy to throw awayEasy to deploy and track errorsFreedom to switch tech stackMaximise team agilityMaximise resource utilisationDebuggingSmooth deployments
DisadvantagesDevops challenge on multiple frontsComplexity in messaging and front endMost container technologies still newFreedom of tech stack not always good news (for the future and for the CTO)Cost PerformanceDeployment andOperation
Anatomy of a MicroserviceDecoupled Middleware design patternMicroservices communicate across a Service Bus (Kafka, RabbitMQ, NATS.io)Service Bus is centralisedMicroservices are distributedTCP communication is generally favouredMicroservices do 1 thing only, and they do it very wellNot restricted to a specific technologyFacilitates Circuit Breaker, Bulkhead, and Handshaking design patternsAvoids cascading failure
Technical BenefitsEliminates dependenciesFailure is isolatedReact to change quicker
Scale is less expensive More intuitive learning curveTechnology stack is not limited to specific skillsetsShielded from legal pitfallsReusable componentsFlexible will bend rather than break under pressure
Micro Service and agilityModern agile practice can not ignore techNo modern tech = no absolute agility Micro services enable agility in a special wayEnforce team creationEnforce faster deployments / better & easier tests CI / CDEasier communication flow methods (APIs)Each service = small scale product
Container Technology in microsContainers assist micro architecture inVisualising servicesBuilding / sharing services between coders Deploying servicesUtilising server resources to run containersirrespective of underlying tech Popular container technologies Docker Rocket
Container Management
Used to maintain and utilize containers /services Make sure all services up and running Make sure server utilisation is maxed outPopular container management technologiesCoreOS fleet Docker-machine MesosKubernetes AWS ECS / Google Container Engine
The Anatomy of a hybrid Service
List of Companies following Microservice Architecture
Comcast CableUberNetflixAmazonEbaySound CloudKarmaGrouponHailoGilt