2
votes

I'm having a sloppy problem loading a viewPanel, the page opens but it looks like the data source is loading all the documents at once, at that point trying to open a listed document takes a long time. Can you tell me if you can limit the amount of documents loaded by data source? to improve performance.

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:this.data>
    <xp:dominoView var="viewProposta" keysExactMatch="true"
        dataCache="nodata">

        <xp:this.categoryFilter><![CDATA[#{javascript:var filtro=[];
                if(viewScope.statusVoltar!=null){
                    viewScope.status=viewScope.statusVoltar;
                    sessionScope.remove("statusVoltar");
                } 
                if(compositeData.filtraUsuario){
                    filtro.push(sessionScope.usuarioLogado.nome);
                }
                if(compositeData.filtraEntidade){
                    filtro.push(sessionScope.usuarioLogado.fk_entidade_funcional);
                }
                return filtro.join("\\");}]]>
        </xp:this.categoryFilter>

        <xp:this.viewName><![CDATA[#{javascript:if(!viewScope.minhasPendencias ){   
            if(compositeData.filtraEntidade){
                switch(viewScope.status) {
                    case "Solicitado":
                        var vw = "vw_parecer_solicitado_entidade"
                        break;
                    ...
                }
            }
            if(compositeData.filtraUsuario){
                switch(viewScope.status) {
                    case "Solicitado":
                        var vw = "vw_parecer_solicitado_usuario"
                        break;
                    ....
                    }
                }
            }else
            var vw= "vw_parecer_minhas_pendencias";

            return vw;}]]>
        </xp:this.viewName>
    </xp:dominoView>

</xp:this.data>


<xp:viewPanel value="#{viewProposta}" rows="20" id="viewPanel1"
    pageName="/xsp_parecer.xsp" viewStyleClass="bloco" var="doc">

    <xp:viewColumn columnName="ds_status" id="viewColumn8"
        style="">
        <xp:this.facets>
            <xp:viewColumnHeader value="" xp:key="header"
                id="viewColumnHeader8" style="text-align:center">
            </xp:viewColumnHeader>
        </xp:this.facets>
        <xp:this.rendered><![CDATA[#{javascript:viewScope.statusVector.length>0}]]></xp:this.rendered>
    </xp:viewColumn>


    <xp:viewColumn columnName="ds_parecer" displayAs="link"
        style="width:18.0%">
        <xp:this.openDocAsReadonly><![CDATA[#{javascript:var valores:java.util.Vector =doc.getDocument().getItemValue("no_destinatarios");
            valores.addAll(doc.getDocument().getItemValue("no_emitente"));
            return !valores.contains(sessionScope.usuarioLogado.nome);}]]></xp:this.openDocAsReadonly>
        <xp:viewColumnHeader style="text-align:center"
            value="Ds_parecer">
        </xp:viewColumnHeader>

        <xp:eventHandler event="onclick" submit="true"
            refreshMode="complete">
            <xp:this.action>
                <xp:actionGroup>
                    <xp:executeScript>
                        <xp:this.script><![CDATA[#{javascript:if(compositeData.filtraEntidade)
                                return sessionScope.retornarPara="/xsp_lista_propostas_unidade.xsp";
                            else
                                return sessionScope.retornarPara="/xsp_lista_propostas.xsp";}]]>
                        </xp:this.script>
                    </xp:executeScript>
                    <xp:openPage target="editDocument"
                        documentId="#{javascript:doc.getDocument().getUniversalID()}">
                        <xp:this.name><![CDATA[#{javascript:return "/xsp_"+doc.getDocument().getItemValueString("form").split("_")[1]+".xsp"}]]></xp:this.name>
                    </xp:openPage>
                </xp:actionGroup>
            </xp:this.action>
        </xp:eventHandler>

    </xp:viewColumn>

    <xp:viewColumn id="viewColumn2" style="width:13%">
        <xp:this.value><![CDATA[#{javascript:
        if(!doc.isCategory()){
            var fk=doc.getDocument().getItemValueString("fk_proposta");
            if(fk == null || fk == "")
                fk = doc.getDocument().getItemValueString("fk_proposta_aux");
            return @DbLookup("","vw_proposta_pesquisa",fk,"ds_proposta");}}]]></xp:this.value>
        <xp:viewColumnHeader id="viewColumnHeader2" value="Proposta"
            style="text-align:center">
        </xp:viewColumnHeader>
    </xp:viewColumn>

    <xp:viewColumn columnName="no_processo_adm" id="viewColumn10"
        style="">
        <xp:this.facets>
            <xp:viewColumnHeader value="No_processo_adm"
                xp:key="header" id="viewColumnHeader10"
                style="text-align:center">
            </xp:viewColumnHeader>
        </xp:this.facets>
    </xp:viewColumn>

    <xp:viewColumn columnName="ds_assunto">
        <xp:this.facets>
            <xp:viewColumnHeader value="Ds_assunto" xp:key="header"
                style="text-align:center">
            </xp:viewColumnHeader>
        </xp:this.facets>
    </xp:viewColumn>
    <xp:viewColumn columnName="unidade_solicitante"
        style="width:8%">
        <xp:viewColumnHeader value="Unidade_solicitante"
            style="text-align:center">
        </xp:viewColumnHeader>
    </xp:viewColumn>
    <xp:viewColumn columnName="no_remetente" id="viewColumn4"
        style="text-align:left">
        <xp:viewColumnHeader value="No_remetente"
            id="viewColumnHeader4" style="text-align:center">
        </xp:viewColumnHeader>
    </xp:viewColumn>

    <xp:viewColumn columnName="ct_posicao_parecer" id="viewColumn3"
        styleClass="centro">

        <xp:this.rendered><![CDATA[#{javascript:viewScope.status=="Concluído"}]]></xp:this.rendered>
        <xp:viewColumnHeader value="Ct_posicao_parecer"
            id="viewColumnHeader3" style="text-align:center">
        </xp:viewColumnHeader>
    </xp:viewColumn>

    <xp:viewColumn columnName="dt_envio" id="viewColumn5"
        styleClass="centro">
        <xp:this.rendered><![CDATA[#{javascript:viewScope.status!="Concluído"}]]></xp:this.rendered>
        <xp:viewColumnHeader value="Dt_envio" id="viewColumnHeader5"
            style="text-align:center">
        </xp:viewColumnHeader>
    </xp:viewColumn>

    <xp:viewColumn columnName="dt_conclusao" id="viewColumn1"
        styleClass="centro">

        <xp:this.rendered><![CDATA[#{javascript:viewScope.status=="Concluído"}]]></xp:this.rendered>
        <xp:viewColumnHeader value="Dt_conclusao"
            id="viewColumnHeader1" style="text-align:center">
        </xp:viewColumnHeader>
    </xp:viewColumn>

    <xp:viewColumn id="viewColumn7" rendered="false">
        <xp:this.value><![CDATA[#{javascript:return ""}]]></xp:this.value>
        <xp:button value="Remover" id="killdoc">
            <xp:eventHandler event="onclick" submit="true"
                refreshMode="partial" refreshId="viewPanel1" id="eventHandler1">

                <xp:this.script>
                    <xp:executeClientScript>
                        <xp:this.script><![CDATA[return window.confirm("Confirma a exclusão?")]]></xp:this.script>
                    </xp:executeClientScript>
                </xp:this.script>

                <xp:this.action><![CDATA[#{javascript:var d:NotesDocument=doc.getDocument();
                    apagarProposta(d);}]]>
                </xp:this.action>
            </xp:eventHandler>
        </xp:button>
        <xp:viewColumnHeader value="" id="viewColumnHeader7"
            rendered="false">
        </xp:viewColumnHeader>
    </xp:viewColumn>
    <xp:this.facets>
        <xp:pager partialRefresh="true" xp:key="headerPager"
            id="pager1" rendered="true" layout="Previous Group Next">
        </xp:pager>
        <xp:pager partialRefresh="true" layout="Previous Group Next"
            xp:key="footerPager" id="pager2">
        </xp:pager>

    </xp:this.facets>
</xp:viewPanel>

2
are you able to share a code snippet of what you have at the moment? - Cameron Gregor
I notice you use dataCache="nodata" which instruct the page to rebuild the view data from scratch whenever a new POST operation occurs - likely this the culprit of your poor performance when going to open a listed document, or at least the reason why it's as slow as loading the view for the first time, granted I understood you correctly. Any particular reason why nodata? - shillem
@shillem i do not know the real reason, the configuration was already this way. But I imagine this is influencing the loading of documents. Can you tell me if loading a view with more than a thousand documents will load everything at the moment the view is accessed? If changing this cache setting can performance improve? - Rafael Dutra
What IBM Domino version are you running and what application xsp properties have you set? - shillem
@shillem version 8.5.3 Xsp properties: xsp.ajax.renderwholetree=true xsp.application.forcefullrefresh=true xsp.application.timeout=90 xsp.compress.mode=gzip-nolength xsp.error.page=error.xsp xsp.error.page.default=true xsp.library.depends=com.ibm.xsp.extlib.library xsp.min.version=8.5.3 xsp.partial.update.timeout=120 xsp.persistence.mode=basic xsp.persistence.tree.maxviews=16 xsp.redirect=false xsp.resources.aggregate=true xsp.session.timeout=90 xsp.theme=titlePages.theme xsp.theme.mobile.pagePrefix=m_ - Rafael Dutra

2 Answers

4
votes

You have some very "expensive" things in your viewPanel like

  • @DbLookup
  • doc.getDocument().getItemValueString(...)
  • doc.getDocument().getItemValue(...)

Try to get rid of them.

It is a performance killer if you access fields in underlaying document(s). It is way better, to include all needed data in view columns.

Even worse is @DbLookup. It executes a call to another view for every row in the view. Try to call @DbLookup from a button or on mouseover only.

0
votes

The number of documents loaded depends on the number of rows defined. The ViewNavigator functionality is optimised to only display the ones for the current page plus some more.

The exception to that is if a Pager has alwaysCalculateLast set to true. If so, it needs to iterate through the whole view in order to work out the page number it needs to display as the last.