How to allow more than 101 TCP connections?

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
RavilN
Sr. Member
Sr. Member
Posts: 14
Joined: 19 Jun 2013, 19:46

How to allow more than 101 TCP connections?

Post by RavilN »

Hi,
I have C++ OPC UA Demo Server with the option MaxSessionCount in the configuration file set to 500, but it is not possible to let more than 101 connections, getting the error that limit 101 connections reached. I can see in the log file message that the option TcpListenerMaxConnections is set to 101, so guess that limit has been reached. Tried to add this option in the config file, but it does not have an effect.
the question: how can I set limit on number of TCP connections, and also probably separately on a number of secure channels? I think these should be configurable separately because customers could want to limit the number of sessions and at the same time allow discovery services still to be available.
thank you, Ravil

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: How to allow more than 101 TCP connections?

Post by Support Team »

Hi,

increasing the number of parallel open connections (session), beyond the max, is not an easy task, there are multiple parameters that need to be considered, some are related to the applications side SDK code and others that are related to the UA Stack, even down to the TCP connections, communication buffers and the like. Such configuration parameters ultimately will have an impact on the "resources" and typically are limited by the device the application is targeted for, some of which should be considered at compile time.

That said we disaggree that a customer should be able to "increase" such limits easily by configuration, especially when going over the tested limit. However, when "decreasing" the number of connections there is a simple to use "MaxSession" parameter, which can be used by customers without the hassle to exhaust the resources, or run the server into an un-tested, maybe critical szenario.

Furthermore we disagree that it would make sense to "discover", but not be able to "create session" (having more securechannels than having sessions), makes not much sense. A developer must consider what is the limitation of his system, which is mainly given by the target device, and set the limits accordingly.
Best regards
Unified Automation Support Team

RavilN
Sr. Member
Sr. Member
Posts: 14
Joined: 19 Jun 2013, 19:46

Re: How to allow more than 101 TCP connections?

Post by RavilN »

OK, there might be no sense to allow more TCP connections or secure channels than the maximum number of sessions. Although OPC UA supports some sessionless requests, but such use cases might be rare, I agree with you.

Anyhow, leaving the possibility of the separate configuration of a number of secure channels aside, how the limit of sessions can be increased and set to something higher than 101? It is about the test instance running at opc.tcp://opcuaserver.com:48010. OPC UA community uses it often for tests, and now they cannot connect it as the limit of TCP connections reaches 101, and no matter what I set in the MaxSessionCount, it does not work.

Thank you, Ravil

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: How to allow more than 101 TCP connections?

Post by Support Team »

Hi,

the number of securechannels is independent of the number of sessions (it is "1"-to-"n"). Therefore you could have multiple session running on the same securechannel. Therefore the same 100 clients could create 5 sessions each, to get the (increased) maximum of 500 MaxSession (default is 100). The number of sockets and the number of securechannels is (in theory) independent as well, and also "1"-to-"n", however for the reasons mentioned above not configurable with our SDK and Stack (compile parameter). BTW you would need a client-side implementation that creates multiple securechannels on one TCP connection (we don't have for obvious reasons).

Anyways, you might be interested in reading this:
https://documentation.unified-automation.com/uasdkcpp/1.7.9/html/CmakeConfigOptions.html#CMakeConfigOptionsUaStack
Best regards
Unified Automation Support Team

RavilN
Sr. Member
Sr. Member
Posts: 14
Joined: 19 Jun 2013, 19:46

Re: How to allow more than 101 TCP connections?

Post by RavilN »

Yes, more than one session could be created in the scope of one secure channel. I am not aware of what client applications support such a feature though. The session is a much more expensive object than just a secure channel, so I don't see any significant benefit in trying to keep the number of secure channels lower than the max number of sessions.

But in this use case, those sessions are not from the same client, they are different clients and moreover can be different applications. As I said this is a demo server instance anyone can connect to over the internet, for the benefit of the OPC UA community. So there is no way to share one secure channel or TCP connection between two or more clients.

To me setting the maximum number of connections to hard code 101 and not making it configurable does not make sense. I don't believe that Unified Automation customers never have more than 101 connections. I assume it is used on much larger scales.

To me the easiest way to allow more sessions than the current number 101 is just to adjust the internal option TcpListenerMaxConnections (it is logged in the log file) if it is less than MaxSessionCount to be the same as MaxSessionCount.

Thanks, Ravil

RavilN
Sr. Member
Sr. Member
Posts: 14
Joined: 19 Jun 2013, 19:46

Re: How to allow more than 101 TCP connections?

Post by RavilN »

Hi,
Any news on this question? How max number of sessions can be increased to values greater than 101?

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: How to allow more than 101 TCP connections?

Post by Support Team »

The way to change the number of sessions supported is to set this parameter in the server configuration (MaxSessionCount).
The stack option TcpListenerMaxConnections is a compile time setting.
I don't believe that Unified Automation customers never have more than 101 connections. I assume it is used on much larger scales.
Customers who need more than 100 SecureChannels can increase the settings when building their product.
Best regards
Unified Automation Support Team

Post Reply