To clear Datapage on each node in Pega PRPC:
In Pega PRPC, using data page will improve the performance of the application, but when its used as necessary way. whether if its really required for Node level or if its required for Requestor Level.
In Some applications unwantedly datapages has been used, and it will have validity of lifetime, means it wil be there till server restarts or pega destroys, when exceeding the maximum allowed now of data pages. As a result, server memory consumption will increase and it will be collected by Garbage collector.
So without disturbing the application or changing the datapage rule, we will see how we can clear the datapage daily, by running the agent, it will be bad way of design, but it will be useful for the application running in the production.
Below mentioned can be called in agent rule and to run it daily morning to clear the node and enable it in all the nodes.
Steps to clear the Datapage cache:
Pseudo code of the activity:
In Pega PRPC, using data page will improve the performance of the application, but when its used as necessary way. whether if its really required for Node level or if its required for Requestor Level.
In Some applications unwantedly datapages has been used, and it will have validity of lifetime, means it wil be there till server restarts or pega destroys, when exceeding the maximum allowed now of data pages. As a result, server memory consumption will increase and it will be collected by Garbage collector.
So without disturbing the application or changing the datapage rule, we will see how we can clear the datapage daily, by running the agent, it will be bad way of design, but it will be useful for the application running in the production.
Below mentioned can be called in agent rule and to run it daily morning to clear the node and enable it in all the nodes.
Steps to clear the Datapage cache:
Pseudo code of the activity:
- get the list of declare page currently in the node using engine api, which will return the pzinskey of the declare page.
- iterate on it and form Page list.
- Iterate on each page and get the declare page name
- using engine api, to clear all the instance of the declare page.
Activity screen shot are given below:
Step 1: create a page new to hold the list of datapage names, which is of class "Code-Pega-List".
Step 2: With Java method. Paste below java code there.
PRNode node = tools.getRequestor().getNode();
result1 ="Node-->"+ node.getNodeUniqueID();
java.util.Set resultSet = node.getDeclarativePageNames();
ClipboardPage ServicePage = tools.findPage("ServicePage");
ClipboardProperty pxResultProperty = ServicePage.getProperty("pxResults");
Iterator Itr=resultSet.iterator();
try{
while(Itr.hasNext()){
//ClipboardPage result2 = (ClipboardPage)Itr.next();
//String result3 = result2.getName();
String result3=(String)Itr.next();
ClipboardPage cd = tools.getThread().createPage("OCBC-Div-Unit-VISA-Work-ServiceRequest","ServicePageResults");
cd.putString("pyLabel",result3);
pxResultProperty.add(cd);
}
}
catch(Exception e){
oLog.infoForced(e);
}
Step 3: loop on page list created.
In step 4 java method:
pega.getDeclarativePageUtils().deleteAllInstancesOfDeclarativePage(result1);
In step 5: page remove method to remove the unwanted pages.
Execute the activity and see to remove the data page from the clipboard.
Note: If you have comments or corrections, please let me know, will update in the post.
Good paddu
ReplyDelete