Primefaces Dialog Framework Perfomance issue

1k Views Asked by At

we are building a Java EE 7 website and having a problem with performance in some situations.

We are using the following components and technologies: Java 1.7 JSF 2.2 EclipseLink 2.5.1 PrimeFaces 4.0 Glassfish Server 4.0 Advantage Database Server 10.10

So, what is our problem exactly? In our main page (round about 2000 DOM elements, mainly JSF and Primefaces elements) we are using the actionListener-Tag of a p:commandButton to call a Java method in a backing bean which opens a dialog (JaNeinDialog) of the primefaces dialog framework.

Since our JaNeinDialog is quite simple, we would expect it to be opened in the browser (firefox 27.0.1) almost immediately. But in fact, it takes 1-2 seconds unitl it is visible.

Amazingly, we have found out, that this waiting time is directly dependent from the original place from where it has been called: As soon as this commandLink is located within a very simple xhtml-page, we see what we had expected: The dialog opens with almost no delay.

So the question is: Why depends the loading time of the same dialog from the complexity of the page from where it has been called?

p:CommandButton which calls a Java method in order to open the JaNeinDialog:

<p:commandLink ajax="true" process="@this"
actionListener="#{patientController.starteMitarbeiterSucheDialog()}">
<p:graphicImage value="/resources/img/png/find_1.png" width="18"
height="21" title="Suche nach Mitarbeiter" />
<p:ajax event="dialogReturn" update="editPflegeDatenPanel"
listener="#{patientController.setPatientMitarbeiter}" />
</p:commandLink>

JaNeinDialog.xhtml:

 <!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
<title><h:outputText
value="#{stringKonstanten.jaNeinDialogTitel}"/></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"></meta>
<h:outputStylesheet library="css" name="jortho.css" />
</h:head>
<h:body>
<h:form>
<center>
<p:panelGrid id="JaNeinDialogPanel" cellspacing="5">
<p:row>
<p:column colspan="2">
<center>
<h:outputText value="#{jaNeinDialogController.dialogText}" />
</center>
</p:column>
</p:row>
<p:row>
<p:column colspan="2">
<center>
<h:outputText value="Aktion ausführen?" />
<BR />
<BR />
</center>
</p:column>
</p:row>
<p:row>
<p:column>
<center>
<p:commandButton id="positiveButton"
actionListener="#{jaNeinDialogController.entscheidungWeiterleiten(true)}"
value="#{stringKonstanten.ja}" icon="ui-icon-check" />
<p:commandButton id="negativeButton"
actionListener="#{jaNeinDialogController.entscheidungWeiterleiten(false)}"
value="#{stringKonstanten.nein}" icon="ui-icon-close" />
</center>
</p:column>
</p:row>
</p:panelGrid>
</center>
</h:form>
</h:body>
</ui:composition>

The used JSF version is the standard Mojarra 2.2.0 implementation which comes along with the Glassfish 4 server.

We've also checked, that there are no scripts being loaded in the body section. Only 2 scripts are loaded in the head section.

Trying the suggestion with flushing, we have followed BalusCs instuction on How to flush buffer early in JSF 2.0? in order to reduce the waiting time for the response. Indeed, this waiting time has decreased by round about 150 ms, but came along with some strange side-effects. Since BalusC does not recommend to use this approach, we reverted this changes.

Using the Firefox-plugin YSlow, we have measured the response time until the dialog shows up. The waiting time for the first element (main.xhtml) takes more than 800 ms waiting time. But the size of this first element is only 987 B. So, how can we find out, what exactly happens in the waiting time of the first element?

We have learned from https://blog.oio.de/2013/05/06/jsf-performance-tuning/ that changing the JSF implementation from Mojarra to MyFaces will improve the performance significantly and we will try to change it now at our Glassfish web server.

We would greatly appreciate any help. Thanks a lot in advance!

UPDATE:

Like suggested from lu4242 (thanks a lot for your assistance!), we tried to change the JSF implementation from Mojarra 2.2.0 to MyFaces. Unfortunately, we were not able to deploy our application after we did this. The whole procedure is described here: Java EE 7 Application not deploying on Glassfish 4 Sever after switching from Mojarra to MyFaces

After that, we learned from http://blog.oio.de/2013/05/16/jsf-performance-mojarra-improves-dramatically-with-latest-release/ that since Mojarra Version 2.1.22 the vast performance loss for sites with a high amount of DOM elements has been fixed.

Therefore we updated Mojarra from version 2.2.0 to 2.2.6, but there is still no improvement of our waiting time. Regardless of what we are doing on our main page, we still have a waiting time of round about 700ms.

YSlow shows, that the size of data transferred from server to browser is minimal (less than 10KB). But the main page is keeping the server busy for a much too long time.

So, we would appreciate any more tipps on this topic.

Thanks a lot in advance.

0

There are 0 best solutions below