Hi! NET Developer Group Braunschweig! Über Tobias Dipl. Informatiker (FH) Passionated Software Developer Clean Code Developer.NET Junkie.NET User Group Lead Microsoft PFE Software Development Twitter @Blubern
Overview 1. What are Microservice 2. Pause 3. Service Fabric 4. Weihnachtsmarkt ;) Fragen gerne - Jederzeit Service Name
What are Microservice? The classic monolithic approach - Everything runs in a single process - Team Focus is on Technology - Changes need a build and deployment of everything - Modularity is in practice hard to keep (SOLID) - Team knowledge - Hard to be Agile - Scaling is hard DB Service Name
What are Microservice? The classic monolithic approach and scaling Load Balancer Server 1 Server 2 - Vertical scaling easy but expensive - Horizontal scaling with disadvantages - You can only clone everything - User has often a endpoint affinity (session) - Failures hard to recover - Persistence is often the bottleneck DB Server 3
What are Microservice? The classic monolithic approach from dev perspective Infrastructure / Platform Team Development Team 1 Development Team 2 Build Test Deploy Development Team 3 Development Team 4 All Teams depends: - DB Schema - Shared Libraries / Code - Technologies - Framework versions (.NET 4.5 vs. Core) - Service Name DB
What are Microservice? Anatomy of a microservice Internal Domain models Domain logic (business logic) Public API - Internals (everything is free) - Domain models - Persistence - Logic - UI - External (Contract) - API - Models Persist ence SOA Bounded Contexts Eric Evans 2003
What are Microservice? Typical microservice architecture - Application is build up from small Prices pieces - API Gateway hides the backend services API Gateway Customer Shopping Cart Products Suggestions
What are Microservice? Benefits of Microservices Development Team 1 Build Test Deploy Business driven Prices Independent deployments Free choice of technology Small focused teams Development Team 2 Build Test Deploy Scalability and availability Shopping Cart Fault isolation Agile (Continues improvements) Development Team 3 Build Test Deploy Customer
What are Microservice? Challenges of Microservices Monitoring and logging Service discovery and routing Versioning Orchestration complexity Network congestion Data integrity/consistency Testing Reliability Manage complexity Amazon Service Architecture 2009 https://apigee.com/about/blog/developer/microservices-amazon
What are Microservice? Challenges of Microservices Business Centric Development Management Teams DevOps Continues Deployment Finding the right size for a microservice Team size Complexity Scaling Fault Business flexibility
What are Microservice? Should I not use the classic monolithic approach Martin Fowler https://martinfowler.com/ bliki/microservicepremium.html
What are Microservice? https://github.com/netflix/chaosmonkey
COFFEE BREAK
What is Service Fabric? https://channel9.msdn.com/blogs/azure/azure-service-fabric
What is Service Fabric? Service Name Source
Where is Service Fabric used? Service build with Service Fabric. - Azure SQL Databases - Power BI - Skype for Business - Azure Document DB -. Service Name 8 Years Productive Same Code and Bits
What is Service Fabric? What is a Service Fabric Application Service C Machine 1 SF Node Machine 2 SF Node Machine 3 Machine 5 Machine 4 SF Node A B C SF Node SF Node
What is Service Fabric? Demo - Local Environment - Azure https://docs.microsoft.com/de-de/azure/service-fabric/service-fabric-get-started
What is Service Fabric? Service Fabric Infrastructure Services Cluster Manager Failover Manager Naming Service Image Store (not on OneBox) Upgrade Services (Azure Only) Fault Analysis Ports 19080 [REST] and 19000 [TCP] Performs cluster REST and PowerShell/FabricClient operations Rebalances resources as nodes come/go Maps service instances to endpoints Contains your Application packages Coordinates upgrading Service Fabric itself with Azure s Service Fabric Resource Provider Let s you inject faults to test your services DNS Service Maps dns names to endpoints
What is Service Fabric? Fault and Updates Domains Fault domains will be defined by the hardware 3 Update domains 3 Fault domains
What is Service Fabric? Platform capabilities Fast deployment Placement and activation Reliability High density Health reporting Coordinated upgrades
What is Service Fabric? What is a Service Fabric Application Service C
What is Service Fabric? What is a ServiceType? code => entry point (dll or exe) config => service specific config information config => data static resources (eg. images) Packages can be independently versioned <ServiceManifest Name="WebServerServicePkg" Version="1.0"> <ServiceTypes> <StatelessServiceType ServiceTypeName="WebServerServiceType"... > </StatelessServiceType> </ServiceTypes> <CodePackage Name="CodePkg" Version="1.0"> <EntryPoint> <ExeHost> <Program>WebServer.exe</Program> </ExeHost> </EntryPoint> </CodePackage> <Resources> <Endpoints> <Endpoint Name="WebServerTypeEndpoint" Type="Input" Protocol="http" Port="8080" /> </Endpoints> </Resources> </ServiceManifest>
What is Service Fabric? Programming Models Guest executables and Containers Reliable Services Reliable Actors ASP.Net Core Any executable Full SF Platform Small Framework Full SF Platform Any technology Small Framework on TOP of Reliable Stateless / Statefull Any programming (C# / Java) Services Reliable Model Stateless / Statefull Stateless / Statefull Collections Not full integrated Reliable Actor Design in SF Platform Collections Pattern Has a subset of Transactions Single Threaded features across Collections Execution Versioning, Transactions Monitoring,... across Collections
What is Service Fabric? Demo - Stateless Service
Cache What is Service Fabric? State Architecture Traditional Stateless Web Stateless Compute Stateful Data Load Balancer Other Internal Tiers? Stateful Stateless Web Stateful Compute Load Balancer
What is Service Fabric? Reliable Collections Reliable Dictionary: Represents a replicated, transactional, and asynchronous collection of key/value pairs. Similar to ConcurrentDictionary, both the key and the value can be of any type. Reliable Queue: Represents a replicated, transactional, and asynchronous strict first-in, first-out (FIFO) queue. Similar to ConcurrentQueue, the value can be of any type. Reliable Concurrent Queue: Represents a replicated, transactional, and asynchronous best effort ordering queue for high throughput. Similar to the ConcurrentQueue, the value can be of any type.
What is Service Fabric? Demo - Statefull Service
THANK YOU
What are Microservice? In short, 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, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies. Service Name James Lewis and Martin Fowler
What are Microservice? Links https://martinfowler.com/articles/microservices.html Transfer from monolithic https://docs.microsoft.com/en-us/azure/architecture/patterns/strangler https://docs.microsoft.com/en-us/azure/architecture/patterns/anti-corruption-layer https://docs.microsoft.com/en-us/azure/architecture/