Is there a way to control either the number of items stored on a data page or its total size on the clipboard?
we would like to use a parameterized node scope data page to act as a cache of frequently used static data read from the DB but also be in control of the number of items being put on the clipboard. Size of entries read from DB is about 2 - 6 MB each and their number may grow in the future. So in order to not have all memory used up by this data page we would like to at least restrict the number of items stored on it or ideally even check on the the actual size of the data page on the clipboard (given that this is not hitting performance too much).
Would it be possible to use "Post load processing" activity on the data page in order to have it check the current item count (or total clipboard size) on the data page after each load operation and if a given threshold is crossed, have, for example, the oldest item removed from it? Are there any concurrency considerations to be taken into account when trying to remove an entry this way? Has this been put in place already by someone in this way or another?
***Updated by moderator: Lochan to add Categories***
Keep the declare-on-change rule in mind for this sort of thing. It is capable of suspending operation of one flow and calling another flow if it detects some condition that may warrant investigation or approval. /Eric
thanks a lot for your response. I am not sure if suspending a flow here would be the right approach. We are looking at a high throughput fully automated processing application that would make use of of this data page as a cache for large objects.
As I described in response to Phani's suggestion, I am able to identify the point in time at which a new entry is being loaded into the page by using the "Load Activity" field and I am also able to remove entries, but I still would need to be able to asses how many and which entries are present on the data page, i.e. get a listing of all available entries. I have tried to get these details using Java API (tools.findPage("D_MyDataPage") but this does not give me information about the contents of the page.
thanks a lot for your response. This is indeed a useful setting which I was not aware of. However, what we are looking for is a more fine grained control over a single dedicated Data Page.
For one thing, we would need to have this removal strategy applied only to a single Data page and not all data pages. Also, we are looking at a high performance application in which it is very likely that all entries will be accessed within 10 minutes, so we would need to be able to set a retention period that is lower than 10 minutes for this particular data page only.
Meanwhile, I was checking on the "Post loading activity" approach: I have written and registered an activity which is run whenever a new entry is being loaded onto the data page and that will remove an entry from it via Page-Remove D_MyDataPage["MyEntryKey"]. This seems to be working fine, even for node scope data pages getting accessed by multiple threads in parallel.
The only problem now is: How can I determine which entries are present on the Data page in order to decide which one to remove? So far I have not been able to get a listing of all entries on the data page or a listing of all available keys. Without knowing, which keys are present, I cannot sensibly remove an entry.
yes, the activity configured at 'post load activity' field runs on the data page result set as an aftermath operation.
>>> How can I determine which entries are present on the Data page in order to decide which one to remove? So far I have not been able to get a listing of all entries on the data page or a listing of all available keys. Without knowing, which keys are present, I cannot sensibly remove an entry.
I haven't tried but could you please share your observations with a precondition ' @(Pega-RULES:Page).PageExistsWithClass(D_MyDataPage["MyEntryKey"], tools)' to remove the page.
I ran the same tests with my Data Page and with page OperatorID. The latter is working fine, Data Page is not working, so syntax is correct. Alos, page is present as I can access it and print some values like pzInskeys of the loaded entries from it.
Directly removing a hard coded works as I have done via Page-Remove in the “Post load activity” but this is not the point: I would need to get some details on the DataPage: What’s the number of loaded keys or alternatively what is their combined size in order to determine if it is time to remove one or more entries. Which keys have been loaded in order to decide which one to remove.
>>> I have tried to get these details using Java API (tools.findPage("D_MyDataPage") but this does not give me information about the contents of the page.
That findPage will return you an object of type ClipboardPage. Start from your developer portal and look at "help - > APIs - > Engine". On left margin, click on PublicAPI. On the page that comes up, you can see the "findPage" you used. Then click on "ClipboardPage" next to the findPage writeup. This will bring you to the "ClipboardPage writeup which will tell you all the things you can call once you have your ClipboarPage object. See if any of those lead you to some of the info you are looking for. /Eric
sorry for the late response but I was on a much needed holiday :-)
Looking at the Public API and methods of ClipboardPage it does not seem to give me access to what I need. I have been playing around with
which is returning an object of type Clipboard page and also had the XML representation of this object written to the log, just to see, what kind of properties/embedded pages etc. are present on it.
Result is, that there does not seem to be any reference to the actual entries of this data page. It seems, as if DataPages LOOK like they contain a page group of embedded pages/entries inside of them but technically/under the hood they are a different kind of thing.
So I am afraid, there is no way to inspect DataPages using Engine API (at least not using the classes I am aware of).