I have performance problem with RemoteCommand caling bean method time lag.
Using primefaces 4.0, our xhtml page, at runtime loads significant amount of
divs into panel
<p:outputPanel id="runtime_panel" autoUpdate="true" />
Some SelectOneRadio controls have listeners through setOnchange() method. They call RemoteCommand, which is defined in xhtml page at design time:
<p:remoteCommand name="ourRemoteCommand"
actionListener="#{bean.someMethod}" update="runtime_panel"
/>
The purpose of bean.someMethod is to show or hide certain GUI controls in our page through ajax. Bean is request scoped.
The problem is, there passed certain time lag, when calling bean.someMethod from client. In my tests, javascript responses suddenly, but there is reasonably long lag passeed when I catch bean.someMethod through breakpoint on server side - about 2.5 seconds.
I also change bean scope to session scoped to eliminate construction phase lag, but this seams not problem - it didnt solve time lag.
If there are only small amount of elements in "runtime_panel", i didn't notice any lag, and breakpoint stops immediately in "bean.someMethod". There is corelation between number of controls and response time.
I also create another test - put dummy RemoteCommand at the beginning of the page at own form.
<form>
<p:remoteCommand name="rcgg" partialSubmit="true" process="@this" update="@none" actionListener="#{bean.testMethod()}" />
<h:outputText id="msgs" value="Ajax Submit" />
<p:commandButton type="button" onclick="console.log('client start');rcgg('ddd');console.log('client end')" value="Ajax1" icon="ui-icon-refresh" />
</form>
So, server side code executes immediately too. But when "outputPanel" has many gui elements, there is also time lag when server side starts to execute, even there is not any relation to this RemoteCommand "rcgg". Strange.
I also tested with several RemoteCommand arributes (
immediate="false" async="true" partialSubmit="true" ignoreAutoUpdate="true" process="@none" global="false"
update="@none"
) but without success too.
I dont have any idea how to get rid of this "bean calling lag".
I really need your help.
Usually you have to use
process=@this
onp:remoteCommand
or else it will submit the entireh:form
and its components.So its better to keep the
p:remoteCommand
in separateh:form
.If this also doesn't work you can always use the
RequestContext
'supdate
method on ManagedBean to update the component.