Azure App Service: Deploying .NET 7 Web API with Cosmos DB Using Docker Containers | Docker | Azure

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 5

  • @ajaymanagaon
    @ajaymanagaon Год назад

    Awesome. Really Amazing Video Series😍

  • @asdasdaa7063
    @asdasdaa7063 6 месяцев назад

    LSM, can you show us how to properly manage session tokens for cosmos db sql api for dotnet? For example how to manage the connection limits, how to deal with many containers? Mainly its about the consistency level (session consistency) im very confused on this and how it should be handled.

    • @learnsmartcoding
      @learnsmartcoding  6 месяцев назад +1

      Hi Gabe, I will make a new full course video for cosmosdb covering most of the important aspects. To answer your questions, here is the breakdown of each aspect.
      Connection Limits:
      Cosmos DB has connection limits to prevent abuse and ensure fair usage. These limits vary based on the type of account you have (e.g., standard vs. serverless) and the throughput provisioned. To manage these limits:
      Use connection pooling to minimize the number of connections opened to Cosmos DB.
      Configure retry policies to handle transient errors and connection failures gracefully.
      Monitor connection usage and adjust resource allocation as needed.
      Managing Multiple Containers:
      When working with multiple containers in Cosmos DB, consider the following:
      Group related data into appropriate containers based on access patterns and query requirements.
      Implement a naming convention or metadata system to easily identify and manage containers.
      Consider using container-level throughput provisioning to optimize performance for each container individually.
      Consistency Levels (Session Consistency):
      Cosmos DB offers different consistency levels, including strong consistency, bounded staleness, session consistency, and eventual consistency. Session consistency ensures that a client session sees its own writes in the order they were performed.
      To handle session consistency:
      Create and manage session tokens for each client session. These tokens are obtained from Cosmos DB upon establishing a session and should be used in subsequent requests to maintain session consistency.
      Store session tokens securely and associate them with each client session. Typically, you'd store them in memory or a secure storage mechanism (such as Azure Key Vault) and retrieve them as needed.
      Ensure that session tokens are passed along with each request to Cosmos DB. This ensures that subsequent requests within the same session are routed to the same replica set, maintaining session consistency.
      Handle session token renewal appropriately to prevent expiration and maintain session consistency across longer-lived client sessions.
      Hope this helps for the time being.
      See you soon in the full course video.
      Happy coding!

    • @asdasdaa7063
      @asdasdaa7063 6 месяцев назад +1

      @@learnsmartcodingthank you so much! I really look forward the course.