Base solution for your next web application
Open Closed

High Avaiablilty and load balancing #12642


User avatar
0
WirelessDynamics created

Hi All,

Does ASP.NET ZERO support the following and how?

1- High Availability. 2- Load balancing. 3-Production – High Availability – Active/Active

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

1 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @WirelessDynamics

    Yes, ASP.NET Zero supports all three concepts, but some parts are available out-of-the-box while others require standard production configuration.

    High Availability

    ASP.NET Zero is HA-ready by design:

    • Uses stateless JWT authentication, so any instance can handle any request
    • Provides a built-in /health endpoint for health checks (DB + cache)
    • Includes Dockerfiles and Kubernetes Helm charts for orchestration
    • Background jobs are designed to avoid conflicts across instances

    However, to make it production-ready for HA, you need to enable a few components:

    • Distributed cache (Redis) - required to share cache across instances
    • SignalR backplane (Redis or Azure SignalR) - required for real-time features in multi-node setups
    • Data Protection key persistence - must be stored in Redis or a shared database to avoid auth/cookie issues
    • Kubernetes probes - connect /health endpoint to liveness/readiness checks

    Load Balancing

    ASP.NET Zero works well behind a load balancer:

    • Supports forwarded headers (X-Forwarded-*) for reverse proxy scenarios
    • Comes with nginx Ingress configuration in Helm charts
    • Sticky sessions are not required due to stateless architecture

    Recommended improvement:

    • Ensure forwarded headers middleware is also enabled in the API Host for correct client IP and scheme handling behind a load balancer

    Active/Active (Multi-Instance)

    Active/Active is supported, but requires proper infrastructure setup.

    Required conditions:

    • Stateless application layer - already supported
    • Shared distributed cache - enable Redis
    • SignalR backplane - configure Redis or Azure SignalR
    • Shared Data Protection keys - persist centrally
    • Background jobs - supported (e.g., Hangfire with SQL Server works safely in multi-instance setups)
    • Database layer - must be highly available (e.g., SQL Server Always On, Azure SQL, etc.)

    Additionally, in Kubernetes deployments:

    • Set multiple replicas
    • Add pod anti affinity rules for true resilience

    Please feel free to contact us if you need any further information.

    Thank you.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)