environment, and is itself constantly changing.” Cornelia Davis, Author of Cloud Native Patterns: Designing change-tolerant software Cloud-Native Software 5 ASP.NET Core Services fit machen Cloud-Native
APIs, and SDKs. Use it to instrument, generate, collect, and export telemetry data (metrics, logs, and traces) to help you analyze your software’s performance and behavior. - ASP.NET Core/.NET emits telemetry data consumeable by OpenTelemetry - Use System.Diagnostics.Activity to create custom traces - Use System.Diagnostics.Meter to create custom metrics Cloud-Native ASP.NET Core Services fit machen Observability 10
ready to serve requests? - Only checked until ready - Live: Is the application still alive? - Checked periodically after ready check - Keep them simple! - Keep “Live” health checks even simpler! - Don’t check for dependencies - This might result in unnecessary restarts of container Cloud-Native ASP.NET Core Services fit machen Health Checks 11
2. appsettings.{environment}.json (ASPNETCORE_ENVIRONMENT) 3. User Secrets (read once at startup in development) 4. Environment variables (read once at startup) 5. Commandline arguments (read once at startup) Cloud-Native ASP.NET Core Services fit machen How does configuration work in ASP.NET Core? 13
- Microsoft.Extensions.Configuration.KeyPerFile to the rescue! - Maps a folder of files into the configuration - Filename is the key - Content of the file is the key - Can be used for e.g. ConfigMaps in Kubernetes Cloud-Native ASP.NET Core Services fit machen How does configuration work in ASP.NET Core? 14
Let the platform handle resilience if possible! - If not: - Some libraries have retries and fallbacks build in (e.g. Azure Storage SDK) - EF Core: “EnableRetryOnFailure” or custom “Execution strategies” - Everything else: Use Polly - Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner. Cloud-Native ASP.NET Core Services fit machen Resilience 16
client - inspects the request to find the proper target - makes the actual http request to the container/service - adds additional headers with data about the client and the called URLs (X-Forwarded-*) - The service - sees the reverse proxy as a client - will be called with a different url/host then it is reachable from the internet - might have different HTTP routes then the reverse proxy - Proxy Route: /api/products - Service Route /products Cloud-Native ASP.NET Core Services fit machen How do reverse proxies work? 20
is not much to do to be cloud-native ready! - Make infrastructure components as configurable as possible! - Use (defacto-)standards where possible! - Be aware of reverse proxy! They are everywhere! Cloud-Native ASP.NET Core Services fit machen Conclusion 21
cloud-14-12-2022 thinktecture.com/ cloud-11-01-2023 Alle Webinare unserer Cloud-Native-Reihe finden Sie hier: thinktecture.com/cloud-native-webinare/ 03. November 2022 – 25. Januar 2023 ASP.NET Core Services fit machen Cloud-Native 22