This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jun 22, 2012, 8:36 PM
11 Posts
topic has been resolvedResolved

Agent Running On Server is Slow?

  • Category: Performance
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags: agent,server agent
  • Replies: 2
Hello,
 
I have a view on an Xpage, where in when I click on a column, it updates the backend document and runs an agent on the server.
The column event formula looks like:-
 
   var mID:String = rowData.getDocument().getItemValueString('tx_milestoneid');
   completeMilestone(viewScope.projectNumberDB, mID);    

   var pDB:NotesDatabase = getExternalDB("FSPROJECTSCHEDULE");
   var pDoc:NotesDocument = getProjectbyid(viewScope.projectNumberDB);
   ag = pDB.getAgent("UpdateSummaryMilestones");
   noteid = pDoc.getNoteID();
   ag.run(noteid);        
 
It does what its supposed to do but just slow. Users notice also it gets slower as the day progress.
 
We used the XPages Toolbox to see which part of the routine takes the most time and we found out that its the agent that I am running.
Here's a snapshot of the log. You can see the agent took 609msec which took the most bulk of the entire routine.
 
 
 
The agent mainly gets it's corresponding summaryDoc and updates 3 fields, one of which is the "tx_openmilestones" (see code below):
 msList = getMilestoneList(openView, searchkey)
 Call s_Doc.Replaceitemvalue("tx_openmilestones",msList)
 
 The getMilestoneList looks like:-
 
Function getMilestoneList(mView As notesView, sKey As String) As Variant
    Dim mctr As Integer
    getMilestoneList = ""
   
    Set sourceECollection = mView.Getallentriesbykey(sKey, True)
    If sourceECollection.Count > 0 Then
        mctr = 0
        Set sourceEntry = sourceECollection.getFirstEntry()
        While Not sourceEntry Is Nothing
            Set sourceDoc = sourceEntry.Document()
            ReDim Preserve mList(mctr) As String
            mList(mctr) = sourceDoc.tx_milestonename(0)
            Set sourceEntry = sourceECollection.Getnextentry(sourceEntry)
            mctr = mctr + 1
        Wend
        getMilestoneList = mList       
    End If
   
End Function
 
I do this 2 more times for 2 other fields. I am guessing that this is what takes the most bulk of the agent's runtime. Not sure how else to optimize this entire process.
Any help/suggestions is much appreciated.
 
Thanks!
 
Chay
Jun 25, 2012, 6:59 AM
135 Posts
Re: Agent Running On Server is Slow?
Move the agent code to the XPage?
Jun 27, 2012, 7:03 PM
11 Posts
Re: Agent Running On Server is Slow?
Thanks for your reply. Even if I transferred the entire routine to xpage, it didn't really do much on the performance. What improved the speed was actually improving the actual code itself. Instead of doing 3 getEntriesByKey, I just did it once and just looped through it to see which document fits what criteria.
 
Thanks again.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal