Hello, all,
I have a short agent that runs on all documents in the view to build a flat file. Running it locally on my test database, it’s lightning fast and done with 700+ docs in several seconds. But running it on 700+ docs on a server test database you can watch individual docs click by (on a Print line). And running it on the prod db with 18K docs is impossible; it stops responding.
A while back I had the same situation, but none of the same factors are present; I do not have ComputeWithForm, there is no GetNthDocument, there’s no tricky Evaluate code or any computations at all. I tried splitting the docs into thirds, using a separate agent for each third, and in the new agents I added code to delete the doc object at the end of each iteration of the Do loop, and I added db.DelayUpdates = True, but there was still no improvement in performance (except that the agent does not hang anymore; 6000 docs get processed, but it takes 20 min).
I inherited this agent from our system administrator, for whom, of course, it worked fine. (I have left a message for him but the user must be able to run this agent by Jan 31, so I am entering panic mode.) We did change servers last spring, but I believe it was last run after that. It was run on a different db because back then the data was in Access and brought into Notes solely for the agent, but the only thing this agent does is get values and print an output string, so I can’t see how that would make a huge difference.
Here is the code:
Declarations:
Dim varoutName As String * 20
Dim varuserName As String
Dim varoutCountry As String * 20
Dim varPOBCountry As String
Dim varoutSpecAcc As String * 6
Dim varSpecAccess As String
Dim varoutDOB As String * 8
Dim varDOB As String
Initialize:
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim coll As NotesDocumentCollection
Dim doc As NotesDocument
Dim filename As String
Dim filenum As Integer
Dim outputstring As String
Set db = s.CurrentDatabase
Set coll = db.UnprocessedDocuments
Set doc = coll.GetFirstDocument
filename ="C:\CVSReport.txt"
filenum = Freefile()
Open filename For Output As filenum
Do While Not doc Is Nothing
varuserName = doc.LName(0)
varoutName = varuserName
varPOBCountry = doc.SubCountry(0)
varoutCountry = varPOBCountry
varSpecAccess = doc.SpecialAccess(0)
varoutSpecAcc = varSpecAccess
varDOB = doc.OPM_DOB(0)
varoutDOB = varDOB
outputstring = doc.SSN(0) & doc.SOI(0) & doc.ClrLevel(0) & doc.RecordType(0) & doc.GrantDt(0) & varoutName &_
varoutDOB & doc.SubState(0) & varoutCountry & doc.OPMExcep(0) & doc.ClrType(0) & varoutSpecAcc &_
doc.Standard(0) & doc.Contact(0) & doc.OPMNonUSFam(0)
Print #filenum, outputstring
Set doc = coll.getNextDocument (doc)
Loop
Close filenum
End Sub
The only substantive difference in the “one-third” agents is that I have Set docNext = coll.GetNextDocument (doc) at the beginning of the loop, and Delete doc and Set doc = docNext at the end of the loop.
Seems like more than a memory problem if there is no performance difference between deleting the doc object and not deleting it… but what is it? There’s hardly enough code to even screw up!
Can someone point me in the right direction?!
TIA
Mark