Hi Daniel Lasota,
Thanks for reaching out to Microsoft Q&A.
Azure Container Apps can generally maintain long-running connections, but they are optimized for event-driven workloads and lightweight microservices rather than handling uninterrupted, long-lived connections like websockets over long periods. This can lead to occasional internet connectivity interruptions or other issues, as you are experiencing.
For a guaranteed stable connection over a long period, you might want to explore the following options:
- Virtual Machines (VMs): A virtual machine offers more control over network configurations and internet stability. Since you can manage things like dedicated network interfaces, private IPs, and even attach a public IP directly to the VM, it might provide the consistency you're looking for in long lived websocket connections. If continuous uptime is critical, pairing it with Azure VM Scale Sets and leveraging redundancy might be a good approach.
Azure Kubernetes Service (AKS): If containerization is essential, moving to AKS might give you more control than Azure Container Apps. AKS also supports attaching a network interface (NIC) resource and customizing networking configurations, which might reduce intermittent outages.
High Availability Zones: Whether using VMs or AKS, deploying resources across Azure Availability Zones can help ensure resilience against outages in a specific zone.
Network Interface Resource (NIC): If you stick with Azure Container Apps or AKS, you could explore adding a network interface resource for more stable networking. However, this may require moving to AKS, as Azure Container Apps doesn't provide as much flexibility in terms of networking.
Azure Application Gateway or Front Door: These services can also provide better management of long-running connections with failover capabilities, especially if combined with load balancing.
In summary, a move to VMs, or even AKS with attached NICs, would likely offer more control over network stability, making them better suited for maintaining long-lived websocket connections.
This might be a bit generic answer but I hope this will help you narrow down.
Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.