Same lotusscript agent extremely slow on Domino 6

We have a large application that does employee Time Entry tracking. After upgrading the server to Domino 6.0.1CF1 (from 5.0.11), deleting and recreating the full text index, running updall -r, and compacting the database to get it to the Dom 6 ODS (43) a fairly simple lotusscript agent that loops through each document in a view, opens it, adds some info. to a field, then saves the document, now takes up to 5 times longer to run. (used to take an hour, now takes close to 5 hours) The agent processes a little over 12,000 documents.

We tried recreating/recompiling the agent in 6 by copying and pasting the code into a new agent. Nothing else has changed.

Same application, same agent, R6 ODS, 6.01CF1 server. Rebuilt the views, compacted the DB. Tried creating a new copy.

Finally, we reverted the ODS BACK to R5 ODS and moved the DB back an R5 test server. We are still dead in the water. Didn’t see anything in the forum similar. This is NOT a Web agent.

Any ideas?

Subject: same lotusscript agent extremely slow on Domino 6

It’s been a while since you posted this, but I’ll respond anyway, since I have dealt with Lotus extensively on this.

If your script instantiates any NotesView objects, include one additional line of code that will improve performance greatly:

Set view = db.GetView( “MyView” )

view.AutoUpdate = False

In R6, Lotus changed several script methods, including NotesDocument.Save, NotesView.GetDocumentByKey, and others, to automatically refresh a view every time a particular script method is called. Lotus explained to me that this was done to make view lookups more reliable. For smaller databases (i.e. several thousand documents), this is not a big deal. But for larger databases (> 10,000 documents), especially when a script updates documents, agents slow down tremendously. Setting the AutoUpdate property to FALSE undoes what Lotus did. Please note that your R6 agents will always run slower than R5, but this trick does improve R6’s response time significantly.

Subject: RE: same lotusscript agent extremely slow on Domino 6

Do give this property to the view is permanent?

Thank you

Subject: same lotusscript agent extremely slow on Domino 6

Reese,

how are you navigating the view? GetNext or GetNth? If the latter, could account for the very slow speed - though not sure why migrating to R6 would make it so much slower.

Do you want to post your relevant code?

Tony

Subject: RE: same lotusscript agent extremely slow on Domino 6

thanks for the response. Using GetNextEntry method of ViewEntryCollection class. The code is fairly lengthy. Let me touch base with the developer.

Subject: RE: same lotusscript agent extremely slow on Domino 6

Here are the details. The agent adds a new field to each document, sets the value of the field, sets values in a couple of other existing fields, saves the document, copies it to an archive database, then gets the next doc in the view and repeats the procedure. This is done for three different views. Here’s the code;

Dim s As New notessession

Set db = s.currentdatabase

Dim ardb As notesdatabase

Dim view As notesview

Dim vc As NotesViewEntryCollection

Dim LogView As NotesView

Dim PPView As NotesView

Dim doc As notesdocument

Dim PayPeriodDoc As NotesDocument

Dim TACount As Long

Dim TASCount As Long

Dim NameList(1 To 2) As String

Set ardb = New notesdatabase("","Paycheck_Archive_Test.nsf")	

Set view = db.getview("T&A Forms")

Set vc = view.allentries

Set LogView = db.GetView("(Process Log)")

Set PPView = db.GetView("(Pay Periods)")

Set doc=view.getfirstdocument

TACount = 0

LogStr$ = Now & " " & db.server & " " & "Archived T&As" & Chr$(10)

’ Archiving TAs

Do Until doc Is Nothing

	Set archived = New notesitem(doc, "Archived", Now)

	Set Item = doc.GetFirstItem("TA_History")

	item.Values = Cstr(item.Values(0)) & LogStr$

	Set item = doc.GetFirstItem("OrgCode")

	subbur$ = Left(item.text,2)

	If subbur$ = "HR" Then subbur$ = "NCS"

	If subbur$ = "BC" Then subbur$ = "NCS"

	If subbur$ = "ST" Then subbur$ = "NCS"

	AdminGrpPtr$ = subbur$ & " PayCheck Admin"

	NameList( 1 ) = "BLM_PayCheck_Admin"

	NameList( 2 ) = AdminGrpPtr$

	Set item = doc.GetFirstItem("StateAdmin")

	item.Values = NameList

	NameList( 1 ) = "BLM_PayCheck_Admin"

	NameList( 2 ) = AdminGrpPtr$

	Set item = doc.GetFirstItem("Authors")

	item.Values = NameList

	Call doc.save(False,False)

	Call doc.copytodatabase(ardb)

	TACount= TACount + 1		

	Set doc=view.getnextdocument(doc)

Loop

’ Archiving Supplementals

Set view = db.getview("(T&A Supplemental)")

Set doc = view.getfirstdocument

TASCount = 0

Do Until doc Is Nothing

	Set archived = New notesitem(doc, "Archived", Now)

	Set Item = doc.GetFirstItem("TA_History")

	item.Values = Cstr(item.Values(0)) & LogStr$

	Set item = doc.GetFirstItem("OrgCode")

	subbur$ = Left(item.text,2)

	If subbur$ = "HR" Then subbur$ = "NCS"

	If subbur$ = "BC" Then subbur$ = "NCS"

	If subbur$ = "ST" Then subbur$ = "NCS"

	AdminGrpPtr$ = subbur$ & " PayCheck Admin"

	NameList( 1 ) = "BLM_PayCheck_Admin"

	NameList( 2 ) = AdminGrpPtr$

	Set item = doc.GetFirstItem("StateAdmin")

	item.Values = NameList

	NameList( 1 ) = "BLM_PayCheck_Admin"

	NameList( 2 ) = ""

	Set item = doc.GetFirstItem("Authors")

	item.Values = NameList

	Call doc.save(False,False)

	Call doc.copytodatabase(ardb)

	TASCount= TASCount + 1		

	Set doc=view.getnextdocument(doc)

Loop

’ Archiving Amendments

Set view = db.getview("(T&A Amendments)")

Set doc = view.getfirstdocument

TAACount = 0

Do Until doc Is Nothing

	Set archived = New notesitem(doc, "Archived", Now)

	Set Item = doc.GetFirstItem("TA_History")

	item.Values = Cstr(item.Values(0)) & LogStr$

	Set item = doc.GetFirstItem("OrgCode")

	subbur$ = Left(item.text,2)

	If subbur$ = "HR" Then subbur$ = "NCS"

	If subbur$ = "BC" Then subbur$ = "NCS"

	If subbur$ = "ST" Then subbur$ = "NCS"

	AdminGrpPtr$ = subbur$ & " PayCheck Admin"

	'TKGrpPtr$ = subbur$ & " PayCheck Timekeepers"

	NameList( 1 ) = "BLM_PayCheck_Admin"

	NameList( 2 ) = AdminGrpPtr$

	Set item = doc.GetFirstItem("StateAdmin")

	item.Values = NameList

	NameList( 1 ) = "BLM_PayCheck_Admin"

	NameList( 2 ) = AdminGrpPtr$

	Set item = doc.GetFirstItem("Authors")

	item.Values = NameList

	Call doc.save(False,False)

	Call doc.copytodatabase(ardb)

	TAACount= TAACount + 1		

	Set doc=view.getnextdocument(doc)

Loop

'Update Log

Set PayPeriodDoc = PPView.GetDocumentByKey("True")

PayYear$ = PayPeriodDoc.PayPeriodYear(0)

PayPeriod$ = PayPeriodDoc.PayPeriodNumber(0)

If Len(PayPeriod$) = 1 Then PayPeriod$ = "0" & PayPeriod$

LogPayPeriodPtr$ = PayYear$ & " - " & PayPeriod$	

LogMsg$ = Now & " " & db.server & " " & "Archived " & Cstr(TACount) & " T&A's and " & Cstr(TASCount) & " Supplemental T&As and " & Cstr(TAACount) & " Amendments for pay period " & LogPayPeriodPtr$ & Chr$(10)

Set LogView = db.getview("(Process Log)")

Set Logdoc = Logview.GetDocumentByKey(LogPayPeriodPtr$)

logdoc.log = logdoc.log(0) & LogMsg$

Call logdoc.save(False,False)

Subject: RE: same lotusscript agent extremely slow on Domino 6

Nothing obvious there. May be worth while putting in some print statements to happen for every 1000th document (or log to a seperate log file if you’ve got a busy server) to get a feel for where the time is being taken.

Sorry I can’t be more helpful

Tony

Subject: RE: same lotusscript agent extremely slow on Domino 6

Thanks for taking a look!We’ll keep digging around.