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
Read performance when using Information Models
April 17, 2015
8:05, EEST
Avatar
Thomas W.
Member
Members
Forum Posts: 7
Member Since:
April 17, 2015
sp_UserOfflineSmall Offline

Hi,

I am connecting to a server using an Information Model. Everything works fine, I get my generated classes returned and can access the values conveniently. The only problem is, that is becomes slow to access all the values I need which are a couple of dozens. The problem seems to be, that with every ‘get’ method a call of the UA server is needed.
Is there any way to fetch the data in a bulk read style but still using the Information Model? Or something similar to an eager and lacy loading of hibernate would be create.

Regards,
Thomas

April 17, 2015
10:24, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, this is a known problem at the moment. There is a NodeCache in the background, it is just configured by default with a short timeout, to ensure that the nodes are always up to date.

You can try to increase the timeout, for example with

client.getAddressSpace().getCache().setNodeMaxAgeInMillis(60000);

or with an even bigger value (in milliseconds).

The effect is that the nodes are no longer read again and again from the server. Just note that the Value is also not refreshed any more. The Value refresh is the reason why we currently define the timeout to be just 1000 ms by default; so we can “guarantee” that the latest value is available from the node, but it also means that the complete nodes are re-read all the time.

We will need to figure out a way to keep the nodes in the cache and still read the value from the server whenever it needs to be, to guarantee that it is up to date.

Reading several nodes with a single read – or enabling some kind of lazy loading would be good ideas for future development as well.

April 23, 2015
11:14, EEST
Avatar
Thomas W.
Member
Members
Forum Posts: 7
Member Since:
April 17, 2015
sp_UserOfflineSmall Offline

The max age works if I want to query a value a second time. But it is still quite slow the first time a getter is called. What I am really missing is a ‘fetchAll’ functionality that reads all (or a couple) of data value in one go using the readValues functionality.

April 23, 2015
13:16, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, I believe you: it fetches currently every node separately and also requests the references and properties separately for each node. So it is making a lot of calls, which could theoretically be combined. In practice, it is more complicated, but we will need to put effort in this in future.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
23 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 738

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1524

Posts: 6451

Newest Members:

jonathonmcintyre, fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1