We have been experimenting running our .NET Core app on both Windows 10 and Linux (Ubuntu 16.04) and are seeing some interest results that we are hoping you can validate, explain and provide some recommendations.
Our original app was written for Windows and was able to support connecting to 300+ OPC-UA server/devices. For each device, the app subscribes to data change events for 4 complex data nodes. The code was written to use a separate EasyUAClient object per device, with isolation set to false. To achieve the 300+ devices, we needed to run two instances of the application on the PC. A single instance of the app starts to fail around 225 devices while use two instances handles 300+. (We don’t have enough device simulators to get over the 300 device number.) Also, we need to set the worker thread count to 1000 and the port thread count to 100.
Int workerThreadCount = 1000;
Int portThreadCount = 100;
ThreadPool.SetMinThreads(workerThreadCount, portThreadCount);
When we run this same app on our Linux server, which is identical hardware as the Windows box, we are only able to support about 120 devices until the application started throwing exceptions. Before the exceptions occur, we noticed that the thread count would fluctuate up and down between 300 and 400. Then after a few minutes, the thread count would start climbing and never recover. To get the maximum performance from the app on Linux, we set the worker thread count to 5000 and the port thread count to 1000.
Here is what a typical exception looks like:
ErrorCode: -1, ErrorMessageBrief: The OPC-UA subscription ID 305 publishing has halted on the client session to endpoint URL "opc.tcp://192.168.1.11:4869" for approximate current duration of 11739 milliseconds. The current keep-alive count is 20, the current publishing interval is 250 milliseconds, and the probationary period was 5000 milliseconds.
workerThreads: 31755, portThreads: 1000, threadCount: 1062
So after some experimentation, we were able to determine that using a single EasyUAClient object for all connection, the app would support more devices on Linux but less on Windows. On the Linux box, the app was able to support about 180 devices across 2 instances of the application. While on Windows, the app was able to support about 120 devices across 2 instances of the application.
Do our results mirror what you’ve seen in your testing?
Do you have any suggestions on how to improve the performance on Linux?