a_MaxAge parameter of the Client_Session_BeginRead function

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

Moderator: uasdkc

Post Reply
nemethz
Sr. Member
Sr. Member
Posts: 10
Joined: 14 Mar 2017, 09:10

a_MaxAge parameter of the Client_Session_BeginRead function

Post by nemethz »

I call the Client_Session_BeginRead function with a_MaxAge = 0.0 and a_MaxAge > 0.0 (e.g. 500.0 milliseconds, 10000.0 milliseconds, and more) parameter but I don't found changing the reading performance.
Why this, are there other options they have to be set for using server's cache?

OPC UA Server: Simatic S7-1500
Version of my ANSI C UA Client SDK: 1.7.0

caspervanzoest
Full Member
Full Member
Posts: 8
Joined: 21 Oct 2016, 14:12

Re: a_MaxAge parameter of the Client_Session_BeginRead funct

Post by caspervanzoest »

What kind of performance change are you looking for?

In the documentation:
Maximum age of the value to be read in milliseconds.
The age of the value is based on the difference between the ServerTimestamp and the time when the Server starts processing the request. For example if the Client specifies a maxAge of 500 milliseconds and it takes 100 milliseconds until the Server starts processing the request, the age of the returned value could be 600 milliseconds prior to the time it was requested.
If the Server has one or more values of an Attribute that are within the maximum age, it can return any one of the values or it can read a new value from the data source. The number of values of an Attribute that a Server has depends on the number of MonitoredItems that are defined for the Attribute. In any case, the Client can make no assumption about which copy of the data will be returned.
If the Server does not have a value that is within the maximum age, it shall attempt to read a new value from the data source.
If the Server cannot meet the requested maxAge, it returns its "best effort" value rather than rejecting the request. This may occur when the time it takes the Server to process and return the new data value after it has been accessed is greater than the specified maximum age.
If maxAge is set to 0, the Server shall attempt to read a new value from the data source.
If maxAge is set to the max Int32 value or greater, the Server shall attempt to get a cached value.
Negative values are invalid for maxAge.
source: http://documentation.unified-automation ... 3d4460715c

Have you tried giving the paramater max Int32 value?

Code: Select all

#include <limits.h>

int imax = INT_MAX;

nemethz
Sr. Member
Sr. Member
Posts: 10
Joined: 14 Mar 2017, 09:10

Re: a_MaxAge parameter of the Client_Session_BeginRead funct

Post by nemethz »

If maxAge is set to 0, the Server shall attempt to read a new value from the data source.
If maxAge is set to the max Int32 value or greater, the Server shall attempt to get a cached value.


Reading time must be shorter in case the server reads nodes form cache than the server reads nodes form data source.
The reading times are same when the maxAge is 0 and the maxAge = INT_MAX.

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

Re: a_MaxAge parameter of the Client_Session_BeginRead funct

Post by Support Team »

Hello nemethz,

it depends on the server if a value cache is implemented or not. If there is no cache, all read calls will be passed to the underlying system and you will not see any difference in the performance.
Best regards
Unified Automation Support Team

Post Reply