How many hybrid connections does Azure relay support - azure

I find that I can use Azure relay to set up a bidirectional connection between cloud service and local service. But I can not find any information about the question "how many hybrid connections does Azure relay support?" in azure website. Does anyone know it? Thanks.

Azure support says that the maximum number of concurrent relay listeners is 2000. When exceeded,
Subsequent requests for additional connections are rejected and an exception is received by the calling code.
This is a system-wide limitation.

Related

Monitoring of Azure Hybrid Connections and OnPremise Data Gateway

I'm using the Hybrid Connection Manager and also the On Premise Data Gateway for several projects hosted in the Azure cloud.
There are more and more use cases for those two components and I need to setup a clean monitoring to detect connection troubles (for example when there is a network issue or a reboot of the servers hosting the gateways).
For the HCM, there are Relays metrics I can rely on, but I saw that some of those counters are not reliable. I had issues with my connexion in the past few days, and when I check the ListenerConnections-ClientError or ListenerConnections-ServerError counters, they always equal to 0... this sounds very strange?
Regarding the OnPremise Data Gateway, I think that because it also relies on SBus Relay, I should probably use the same metrics?

Azure Relay Hybrid Connection Scale Out

Given the standard hybrid OnPrem/Cloud scenario where we have multiple OnPrem clients connecting to a service in the cloud, how can we service them all from a scaled out service (i.e. multiple listeners servicing multiple clients)?
Say we have a cloud service that implements the Hybrid Relay listener, and to service all of our clients we scale it out to N instances(up to 25). Clients get assigned to each instance via the documented load balancing feature so that each listener services a portion of the clients. What if we need to broadcast messages to all of the clients (like a chat application)? As far as I can tell, any single listener never has access to all of the client connections. Am I missing something?
I've used https://learn.microsoft.com/en-us/azure/service-bus-relay/relay-hybrid-connections-dotnet-get-started as an example to play around with this scenario by standing up multiple servers (listeners) with multiple clients (connections) connecting to each server, but there doesn't seem to be a way to broadcast or lookup ALL of the connections to the namespace, only the connections in the current listener scope.
but there doesn't seem to be a way to broadcast or lookup ALL of the connections to the namespace, only the connections in the current listener scope.
Message transfer of Azure Relay Hybrid is based on the connection. If a client is not connected to a server, we can't send message to the client from the server.
For the broadcast scenario, I suggest you use Azure Service Bus topics. After created a topic, you could subscribe this topic for all the clients. When we send a message to the topic, all the subscriptions will receive the message.
For how to use Azure Service Bus topics, link below is for your reference.
Get started with Service Bus topics(.NET)

How can I get a list of TCP connection statuses for an Azure App Service app?

We have an Azure App Service Plan with 20+ applications.
One of the apps is causing port exhaustion. All the apps on the pricing plan lose connectivity as a result.
Tech support indicate TIME_WAIT status TCP connections are predominant when the port exhaustion happens. To help diagnose and monitor this and future situations, I want a general way of getting TCP connections and statuses per app.
Is this possible? If so how?
I realize this isn't a direct answer to your question, but we have a similar issue and found our use of HttpClient to be a contributing factor. If you're using a new HttpClient instance for each of your HTTP requests, you could be exhausting your available outbound connections. We found the following article to be very helpful in minimizing the number of outbound connections using HttpClient: https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/
We are also hoping for a way to view TCP connections from Azure App Services, since Kudu shows "Access Denied" when trying to use netstat.
This is now a popular question. To add some extra info, the outcome of the investigation was that one app was using a MySQL client library that had some kind of bug. It was not closing TCP ports correctly. This killed the whole plan. After talking with Azure tech support they agreed that there should be improved reporting of TCP connectivity in the Azure portal. Since then I have not checked if there have been any improvements.

Disconnection issues with azure service bus relay

We are running some long-running test apps with Azure Service Bus relay over http, hosted in a windows service and most of the time, these run fine for 2-3 days. However every so often an internal network glich may occur (e.g. firewall reboots) that kills the internet connection.
At this point, the relay is dropped in Azure and our web app can no longer communicate with the on-premise service.
I would have thought that the Azure relay client was fault-tolerant - in that if it realises that it's lost connection with Azure then it will re-establish the connection andf if it can't keep trying until it can.. but it appears that this is not the case. This seems pretty fundamental...?
Only once have I ever seen a "System.ServiceModel.CommunicationException" where the service can't communicate on the internet, and that was when the client was starting up and trying to establish the connection in the first place.
Is there any advice or feedback on handling transient disconnections through the relay service (as it's a cloud --> on-prem direction then the client can't AFAIK ping the server).
If you are still experiencing issues, you may want to contact Azure support to understand why it is disconnecting. The Relay client should reconnect if something happens to the existing connection.
You may want to add ConnectionStatusBehavior to your ChannelFactory to have it output when the status for the connection changes. It will contain the error that caused it to change status.
var connectionStatusBehavior = new ConnectionStatusBehavior();
connectionStatusBehavior.Online += ConnectionStatusOnlineMethod;
connectionStatusBehavior.Offline += ConnectionStatusOfflineMethod;
channelFactory.Endpoint.Behaviors.Add(connectionStatusBehavior);
This issue is solved by Microsoft in version 2.6.5 of Microsoft Azure Service Bus dll. After 1 month of testing it seems to work.

Using Service Bus to send messages from a Web Role to all other Web Roles

I’m designing a backend that allows users to establish a TCP socket with it and send/receive stuff along this socket (using a pseudo-protocol I’ve made up) in real-time.
It has to be scalable – i.e. architected on a cloud host. Currently I’m evaluating Windows Azure.
To achieve scalability the application will run on several Web Role Instances. Meaning the users’ TCP sockets will be split across several instances (via a load balancer).
This backend is an event-driven application – when a user sends something to it the message should be passed on to all other connected users.
This means there must be a reliable way to send messages from one Web Role Instance to all other Web Role Instances. As far as I understand, this is what inter-role communication refers to.
Using Service Bus, is it possible for all Web Role Instances to subscribe to a Topic and publish messages to it? Thus implementing the event-driven requirements of my distributed application?
(If not then I’ve misunderstood what this article is about: http://windowsazurecat.com/2011/08/how-to-simplify-scale-inter-role-communication-using-windows-azure-service-bus/)
I wanted to find this out before delving too deep into learning C#, .NET and Windows Azure development.
Thank you for your help.
Yes, using the service bus, all the web roles could send messages to a single topic and each role could have unique individual subscriptions to that topic, such that they all receive the messages sent.
Clemens Vaster has implemented an extension to SignalR using the service bus. It is possible that SignalR + the Service Bus may meet the needs of your project, including the TCP socket implementation.
http://vasters.com/clemensv/2012/02/13/SignalR+Powered+By+Service+Bus.aspx

Resources