3 Replies Latest reply on Aug 25, 2008 11:48 AM by gjeudy

    Bad AJAX performance with large dataset

    gjeudy

      Hi,

      Hi,

      I'm using Richfaces 3.2.1

      I am rendering a rich:listShuttle with 619 elements, the whole JSF request takes around 35 secs, 25 secs spent parsing the resulting html to well-formed XML for the ajax response. My java profiler (jrockit mission control) shows me 48% of the time was spent in

      org.ajax4jsf.org.w3c.tidy.DOMNodeListByTagNameImpl.pretraverseNode()

      See org.ajax4jsf.webapp.BaseXMLFilter.doXMLFilter()

      See related JIRA:

      https://jira.jboss.org/jira/browse/RF-3717

      Any hopes in getting some performance optimization for this ? It is a very big bottleneck.

      Hopefully these kinds of hacks wont be needed when JSF 2.0 spec comes out with new designs better integrating AJAX processing.

        • 1. Re: Bad AJAX performance with large dataset
          gjeudy

          Sorry I forgot to post my facelets sample, so the a4j:support action="#{classificationUseAction.selectCoverage}" triggers the reRender (ajax request mentioned in my previous post):

          <a4j:outputPanel id="coveragesPanel">
           <a4j:region id="coveragesRegion">
           <a4j:form id="coveragesForm" rendered="#{not empty coverages}">
           <s:span styleClass="label">Coverages (from selected product)</s:span>
           <s:div id="rel">
           <h:selectOneListbox id="coverages" required="true"
           value="#{selectedCoverage}" size="10">
           <s:selectItems value="#{coverages}" var="coverage"
           label="#{coverage.specificationNm} -- #{coverage.specificationCd}" />
           <s:convertEntity />
           <a4j:support action="#{classificationUseAction.selectCoverage}"
           reRender="existingClassificationUsesPanel" event="onclick"></a4j:support>
           </h:selectOneListbox>
           </s:div>
           <a4j:status>
           <f:facet name="start">
           <h:graphicImage value="/img/spinner.gif" />
           </f:facet>
           </a4j:status>
           </a4j:form>
           </a4j:region>
           </a4j:outputPanel>
           <a4j:outputPanel id="existingClassificationUsesPanel">
           <a4j:form id="existingClassificationUseForm"
           rendered="#{(not empty unrelatedClassificationUses) or (not empty relatedClassificationUses)}">
           <rich:listShuttle targetValue="#{relatedClassificationUses}"
           sourceValue="#{unrelatedClassificationUses}"
           targetCaptionLabel="Related Classification Uses"
           sourceCaptionLabel="Unrelated Classification Uses"
           fastOrderControlsVisible="false" orderControlsVisible="false"
           moveControlsVisible="${editMode}" fastMoveControlsVisible="${editMode}"
           listsHeight="400px" sourceListWidth="400px" targetListWidth="400px"
           copyAllControlLabel="Relate All" copyControlLabel="Relate"
           removeAllControlLabel="Unrelate All" removeControlLabel="Unrelate"
           converter="#{com.archinsurance.web.converter.IdentifiableConverter}"
           var="classificationUseVO">
           <h:column>
           <f:facet name="header">
           <h:outputText value="Class Code" />
           </f:facet>
           <h:outputText
           value="#{classificationUseVO.classificationSpecISO.code}" />
           </h:column>
           <h:column>
           <f:facet name="header">
           <h:outputText value="Class Name" />
           </f:facet>
           <h:outputText
           value="#{classificationUseVO.classificationSpecISO.classificationDesc}" />
           </h:column>
           <h:column>
           <f:facet name="header">
           <h:outputText value="Cov Group Name" />
           </f:facet>
           <h:outputText
           value="#{classificationUseVO.classificationSpecISO.coverageGroup.description}" />
           </h:column>
           <h:column>
           <f:facet name="header">
           <h:outputText value="Valid From Dt" />
           </f:facet>
           <rdm:smartDate id="validFromDt"
           value="#{classificationUseVO.validityPeriod.validFromDate}" ajaxValidate="false" />
           </h:column>
           <h:column>
           <f:facet name="header">
           <h:outputText value="Valid To Dt" />
           </f:facet>
           <rdm:smartDate id="validToDt"
           value="#{classificationUseVO.validityPeriod.validToDate}" ajaxValidate="false" />
           </h:column>
           </rich:listShuttle>
           <h:commandButton action="#{classificationUseAction.save}"
           rendered="${editMode}" value="Save" />
           </a4j:form>
           </a4j:outputPanel>


          • 2. Re: Bad AJAX performance with large dataset
            nbelaevski

            Hello,

            Try to use another parser. Example of parser configuration:

            <context-param>
             <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
             <param-value>TIDY</param-value>
             </context-param>

            Possible values are TIDY, NEKO, NONE (from slowest to fastest).

            P.S. Filter should be set to org.ajax4jsf.Filter for this to work.


            • 3. Re: Bad AJAX performance with large dataset
              gjeudy

              Thanks for the tip.

              Using NEKO brings parsing times down to: 1200ms or so. Very nice!

              Using NONE (which I realize still uses FastHtmlParser under the hood) brings down this time even further to 600ms or so.

              Any reasons why TIDY is the default parser being used ? I don't want to bring other problems while using NEKO or NONE.

              Ideally if you can provide info on when I should use one parser but not another.