Luca MezzaliraPrincipal Serverless Specialist Solutions Architect亚马逊云科技 Luca Mezzalira Principal Serverless Specialist at AWSInternational SpeakerAuthor Distributed Systemsare LIVING systems Distributed systems goals Organizationscalability Fasterfeedback loop BusinessAgility Reduceblast radius Reduce externaldependencies How does serverless fitin distributed systems? Serverless is a STRATEGY Where can serverless help? How to designServerless applications CONNECTED DIMENSIONS in distributed systems Organization Any organization that designs a system willproduce a design whose structureis a copy of the organization'scommunication structure. Melvin E. Conway1967 Centralized mindset Decentralize mindset Federated Service (i.e. X-as-a-Service) Serverless is an extensionof your enablement teams 1Enh a ncingtheDeveloperExp e r ienceforthevaluestreamteams Enablement teamsfocus with Serverless Culture Decentralize& Empower Developing a culture of serverless-first Quick Wins Form CCOE Leadership Support Establish clearvision andsupport fromleadership Deliver strategic“light house”modernizedworkloads Evangelize Reorganize Best Practices DecentralizeCCOE functionand federateacross theorganization Build reusablepatterns, referencearchitecture, andshared services CommunityBuilding andEnablement System Architecture EvolutionaryArchitecture Architecture begins with2Definingarchitecturecharacteristicstoidentifytherightpatternstoapply 3MapyourdesignintoAWxse r v ices A spectrum of compute for different needs Selecting services that fit your strategy Step OneStart with the highest abstraction Step TwoMove to a lower Step ThreeIterate and evolve Design Principles Modularity Modularity: the quality of consistingof separate parts that, when combined,form a complete whole. Cambridge Dictionary A system lacks modularity whena tweak to one of its componentsaffects the functioning of others. Cambridge Dictionary Modularity using code •Strong encapsulation•Large usage of design patterns•Decouple business logic fromenvironment•Developers discipline Modularity using infrastructure •More options to express yourintents•Configuration over code•Many common built-in behaviors•More control on what to develop Architecture and patterns enabled by Serverless Microservices DataArchitectures How to design a workloadusing Serverless Business requirements •Gift code service for an e-commerce •Gift codes can be generated by the system or 3rdparty companies •For every gift code consumption we need to Notify the customer support teamUpdate the user’s account historyIf the gift code was issued by 3rdparty company notify them Workload Characteristics •99.99% availability on critical path•99.9% availability on the rest of the system •Events to communicate across bounded context •Under 1 second response time for the user facing APIs•Scale to up 3000 TPS with 50% headroom High-level architecture Architectural characteristics Team topology Serverless implementation •Synchronous API•Quick acknowledgment forthe users•Only part that needs to scalebased on users traffic•DynamoDB Streamsbecomes the glue with theasynchronous part of thesystem Serverless implementation •Synchronous API•Step Functions orchestratesdifferent services to generateor update gift codes•API Gateway helps to mitigateeventual traffic spikes from3rdparty services Serverless implementation •Events allow the decouplingof producers and consumers•DynamoDB Streams notifiesevery change in theDynamoDB table•EventBridge Pipes enrich theinformation received fordownstream services•EventBridge is the messagebroker Serverless implementation •Some 3rdparty systemsaccepts an API calls in theformat defined by yoursystem•Some others require totranslate from JSON to XMLor any other format•More architectural patternsare also applicable Serverless implementation •CRM has API limits so a queuehelps us to ease the traffic•User account uses a Lambdafunction to manipulate theevent and then integrateinside their bounded context Ready for the future… Express your architecture characteristicsand business requirements intoinfrastructurefocusing onYOUR BUSINESS goals not buildSOFTWAREG nOW Frederick Brooks(Computer Architect) 谢谢 Luca Mezzaliralmezza@amazon.com