Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
todor_petrov
Contributor
0 Kudos

Recently I had some discussions with a customer of ours that landed doubt on the fact that Web Dynpro context access is the fastest possible way to create and retrieve data within a Web Dynpro application. Since I didn’t found any benchmarks from SAP direct, I just decided to test the thing myself.

The application is relatively simple, including one non-visual and one visual controller with their contexts mapped. The component controller context looks like this:

We have a context node People that is mapped to a Structure and having the cardinality: 0..n. The other node is just a helper to hold the record count attribute, which is mapped to the input field in the view controller. The complete UI mask has the following look:

The button on top is mapped to an action that calls a method in the non-visual controller. The method itself implements the creation of the elements and the calculation the time intervals:

public void createRecords( int recordsNo )
{
//@@begin createRecords()
wdContext.nodePeople().invalidate();
long startTime = System.currentTimeMillis();
int i=0;
for(i=recordsNo; --i>=0;){
IPeopleElement peopleElement = wdContext.nodePeople().createPeopleElement();
peopleElement.setFIRSTNAME("John"+i);
peopleElement.setLASTNAME("Mills"+i);
peopleElement.setAGE(i);
peopleElement.setOCCUPATION("Consultant"+i);
wdContext.nodePeople().addElement(peopleElement);
}
long endTime = System.currentTimeMillis();
this.msgManager.reportSuccess("Elapsed time: "+(endTime-startTime)/1000+ " s");
//@@end
}

Our application is ready to be tested. I’ve ran it for 4 different record counts a couple of times. You can see the results in the following table:

Created records

Estimated time

1,000

0 sec.

10,000

0 sec.

100,000

0 – 3 sec.

1,000,000

14 – 21 sec.

A screenshot from the last test also shows that the record creation for 1 million records could vary depending on the current load of the J2EE Server:

I guess after this small representation of what the Web Dynpro context is capable of, no one is in doubt that it is one of the fastest possible way to access data in a running Web Dynpro application.

On popular demand I also tested how long it would take to save the data to a java array from a java class that has the same properties. The results were impressive - 1 000 000 records within 3 to 4 seconds. Not bad, but we must not forget that this includes only writing to the array and the display is not taken into account and believe me displaying a java array in Web Dynpro still means that you have to save the data to the context. Another aspect is the typed API that the Web Dynpro context provides and is so easy to work with. Whereas with java classes, we would have to generate the get and set methods manually or at best automatically with NWDS integrated functionality.

 
10 Comments