Tuesday, April 26, 2016

Optimize ADF HTTP Response Size with ChangeEventPolicy

You should read this post, if you are looking how to reduce ADF HTTP response size. This can be important for ADF application performance tuning, to improve PPR request response time. By default in ADF 12.2.1, iterator is assigned with ChangeEventPolicy = ppr. This works great for UI component bindings refresh, no need to set individual partial triggers. On other side, this generates extra content in ADF HTTP response and eventually increases response size. I would recommend to use ChangeEventPolicy = ppr, only when its really needed - dynamic forms, with unknown refresh dependencies. Otherwise set ChangeEventPolicy = none, to generate smaller response.

I will demonstrate below the difference for ADF HTTP response with ChangeEventPolicy=ppr/none. First let's take a look into page load response size:


Page contains list component and form. Both are based on two different iterators, set with ChangeEventPolicy = ppr. This generates AdfPage.PAGE.updateAutoPPRComponents calls for each UI item, referencing attributes from the iterator. In complex screens, this adds significant amount of extra text to the response, could increase size even by half:


Partial response also contains same calls added to the response. Select list item:


Each item from the form will be referenced by JavaScript call, to register it for refresh:


Let's change it to ChangeEventPolicy = none. Set it for both iterators:


We should set refresh dependencies manually. Form block must be set with PartialTrigger, referencing list component - to refresh, when list selection changes:


Next/Previous buttons dependency also must be set, to change form row:


With manual refresh dependency changes, there are no extra calls added to ADF HTTP response, reducing overall response size:


Same applies for PPR response:


Download sample application - ChangeEventPolicyPPRApp.zip.

3 comments:

Ninjaz4Java said...

Excellent post as always , Andre

TJ said...

Hi Andrejus ,

Is there a contradiction in what Fedor is trying to say here. He mentions only those components are refreshed for which the attribute is changed even when to changeEventPolicy is set to ppr.

http://adfpractice-fedor.blogspot.com/2014/07/smart-auto-ppr-change-event-policy.html

Thanks,
Tarun

Andrej Baranovskij said...

My point with ChangeEventPolicy=ppr, there are much more text (JavaScript) content in ADF HTML response. This extra content can be avoided, with manual PartialTriggers.

ChangeEventPolicy=ppr will be invoked for all attributes, each time you click Next (etc.) button, to display next row content. In practice, on large forms, there are a lot of PPR content and all ID's will be in HTML output with updateAutoPPRComponents. This will generate extra KB in ADF HTML response.

I would recommend to use ChangeEventPolicy=ppr, only when you dont know PartialTrigger dependencies on design time. Unless you don't want to deliver more performance responsive behavior :)

Regards,
Andrejus