Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Cloud-Native .NET

Spring Connect Charlotte
Cloud-Native .NET
Speaker: Cornelius Mendoza

  • Login to see the comments

  • Be the first to like this

Cloud-Native .NET

  1. 1. © Copyright 2018 Pivotal Software, Inc. All rights Reserved. Cloud Native .NET Spring Cloud Connect Fall 2019 Cornelius Mendoza
  2. 2. Why containerize Windows .NET Workloads Driving Business Outcomes ● OS Versioning ● Operational efficiency / Patching ● Reduce licensing costs ● Simplify Scalability ● Improve Availability ● Increase Development Agility
  3. 3. Cloud Native Journey Cloud Native Cloud Resilient Cloud Friendly Cloud Ready ● Microservice Architecture ● Function/Event/API first design ● Design for failure ● Proactive testing for failure ● Apps are unaffected by dependent service failure ● 12 Factor apps ● Horizontally scalable ● Leverage platform for HA ● No file system requirements ● Containerized ● Platform managed addresses and ports ● Consume Platform services ● Integrated Metrics and Monitoring ● Cloud agnostic runtime implementation
  4. 4. Windows Containers Win-C Standard Containers ● Officially supported in Windows 2016 – We been doing containers since Windows 2012R2 ● Win-C container standard ● Support for Kubernetes deployed containers in Windows 2019 (Build 1903+) ● Containers need to be rebuilt for major version releases of Windows ● Hyper-V isolation for kernel-mode isolation for enhanced security ● Implemented using Microsoft Container APIs
  5. 5. What fits in a Windows Container? Supporting legacy applications ● Minimal operating system ● Full Windows install (C:Windows) ● Structured file system (C:, C:Program Files) ● Registry ● .NET runtime ● Different .NET runtimes side by side - host OS is neutral to the version(s) ● Patch host operating system with no regard to apps within
  6. 6. Writing Twelve Factor ASP.NET Applications ● Avoid in-process session state* ● For ASP.NET override MachineKey in web.config and on ASP.NET Core avoid persisting keyring to filesystem* ● On ASP.NET avoid environment specific configuration in web.config ● Avoid Integrated Windows Authentication ● Avoid the GAC ● Avoid custom IIS handlers ● Avoid anything that uses the Windows registry ● Avoid libraries that depend on DPAPI ● Avoid using local disk for storing application state* ● Avoid using any Windows specific or disk-based logging* ● Avoid any 32-bit specific libraries or libraries that can’t be bin deployable* ● Platform dependent naming conventions - i.e. environment variables ● MSI deployed libraries requiring host level access
  7. 7. Benefits of PCF for .NET Apps How Pivotal Application Service (PAS) and PAS for Windows evolves the .NET DevOps experience. ● Deploy .NET Core or .NET Framework apps. ● For .NET Framework, uses Windows Server Containers, first delivered with Windows Server 2016. ● Automatically builds a full, OCI-compliant container image, supplying key .NET, IIS, and Windows features. ● Transparently patches all .NET applications with updated container base images from Microsoft, live in production with no downtime. ● Scale out .NET running apps, manually or based on CPU load or traffic. ● Deploy Windows Updates in rolling fashion to all live Windows VMs with BOSH. ● Provide .NET debugging and troubleshooting features.
  8. 8. Deploy source code that the platform containerizes for you or Deploy container images that you build yourself push source code Developer Cloud Foundry Cloud Controller triggers staging Diego creates container Diego mounts root file system Diego lays down buildpack, source code Diego builds and uploads droplet Diego schedules containers onto Cells Running app!
  9. 9. Focus on developer productivity Build all things .NET... Run all things .NET... ✓ .NET Full Framework/.NET Core ✓ Early application lifecycle and evolving CI/CD pipelines ✓ Limited testing coverage ✓ Frequent changes to code ✓ Complex deployments with many service dependencies ✓ On-demand services ✓ Multi-tenant deployments ✓ High-compliance requirements ✓ .NET Core ✓ Mature application lifecycle and CI/CD pipelines ✓ Comprehensive testing coverage ✓ Infrequent changes to code ✓ Self contained application deployments ✓ Service deployments ✓ Customer hosted deployments ✓ Flexible compliance requirements “Use the right tool for the job”
  10. 10. Spring Cloud Services for .NET Using Steeltoe Libraries for .NET Applications
  11. 11. Health Actuators Add this... Get this!!
  12. 12. Externalized Configuration • Built on ASP.NET Core Configuration & Options extensions • • •
  13. 13. Dealing with Failures • Stop sending requests to a failing service (allowing time to recover) • Fail gracefully by implementing fall- back behavior • Open Circuit = Failed method • Closed Circuit = Successful method
  14. 14. Dealing with Failures Implement HystrixCommand RunAsync() Method Runs every time, in own thread RunFallbackAsysnc() Method Only run when RunAsync() fails (Circuit is now open)
  15. 15. Dealing with Failures Visibility into Failures Application Wide
  16. 16. Discovering Services • Use Service IDs, not URLs, to locate services • Client-side or server-side load balancing
  17. 17. Discovering Services AddDiscoveryClient(config) Method Adds Discovery client to the service container UseDiscoveryClient() Method Starts up the client in a background thread
  18. 18. Demo Improving Developer Productivity
  19. 19. Here is my .NET code Run it in the cloud for me I do not care how