Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Anything to taka care of when using multiple UaClient object in one Java application
June 14, 2022
17:50, EEST
Avatar
rocket science
Member
Members
Forum Posts: 65
Member Since:
March 16, 2017
sp_UserOfflineSmall Offline

Hi,
is there anything to take core of when using multiple UaClient Object in one Java application?

So. e.g.

private UaClient client1;
private UaClient client2;

client1 = new UaClient("opc.tcp://server1:4980");
client2 = new UaClient("opc.tcp://server2:4980");
…..
…..
client1.connect()
client2.connect()

Do I have to take care of anything e.g. static settings in any class of the SDK which may cause any problem?

June 15, 2022
9:16, EEST
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 207
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

There isn’t any limitation on how many instances of UaClient class you can have in one Java application. Naturally, static methods that are used to set values of static fields such as UaClient.setUseCommErrorCodes(boolean) would affect all UaClients.

In general, I would say that there shouldn’t be any problems with any static settings and there are relatively few of them to begin with. But if you do come across any static settings that you would like to be able to control independently for each instance of UaClient or any other SDK class, please let us know and we’ll see if those could be changed.

June 15, 2022
9:55, EEST
Avatar
rocket science
Member
Members
Forum Posts: 65
Member Since:
March 16, 2017
sp_UserOfflineSmall Offline

Thanks! Cool

June 15, 2022
10:44, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 775
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Some extra notes from me:

How many UaClients we would be talking? 10s, 100s?, 1000s??

The ‘stack layer’ due to historical reasons do utilize (sometimes very much) shared threadpools in the StackUtils class. The ‘NonBlockingWorkExecutor’ gets equal threads to CPU cores and the ‘BlockingWorkExecutor’ will get 64 threads (configurable via StackUtils.setBlockingWorkerThreadPoolCoreSize(…), this must be called before other interactions with the SDK, start of main etc.).

Also each UaClient does use 2 internal threads (one reads the socket in the ‘stack layer’ and another in the ‘SDK layer’ doing status checks and PublishRequests/Responses).

Also it should be noted that nowadays UaClient does by default Read/Browse the Types part of the server on connect.

Message decoding happens on the blocking work pool (so socket reading can continue), thus it should be noted that while the clients obiviously do not interact with each others per se, they “indirectly do so” by sharing the same “decoding pipe” due to the pool. In practice I would say this is something that you can probably ignore, but is something to we aware; might help later if there are issues (and hopefully increasing the pool size would help then), but let us know if there are any.

June 20, 2022
17:56, EEST
Avatar
rocket science
Member
Members
Forum Posts: 65
Member Since:
March 16, 2017
sp_UserOfflineSmall Offline

Thank you for the extra info. Currently the number of UaClients is below 10, so the threadpool should’nt be an issue, but thanks for talking about this just in case there are issues when no of clients may increase Smile

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 267

Currently Online: Larryorarm
9 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 120

pramanj: 86

ibrahim: 74

rocket science: 65

kapsl: 57

gjevremovic: 49

Xavier: 42

fred: 41

TimK: 41

Fransua33: 39

Member Stats:

Guest Posters: 0

Members: 2891

Moderators: 17

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1261

Posts: 5369

Newest Members:

allisontz18, Elmer1493vok, AspectMontageAtrox, miloparris0, josettegrenier, berniceiy1, Sylviaser, gilbertstonge93, waldomarriott43, madgeroque72

Moderators: Jouni Aro: 930, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 775, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 25, Teppo Uimonen: 21, Markus Johansson: 39, Niklas Nurminen: 0, Matti Siponen: 207, Lusetti: 0

Administrators: admin: 1