Profile your LotusScript Agents
Posted by Bruce Lill on December 13th, 2009 | Category:
I just spent the last few week doing an infrastructure review because of the bad performance they've been having. I reviewed a lot of logs, setup the Domino Domain Monitoring and got the servers running OK. It was then that I started to look at the agents and LEI events. What I found surprised me, after 5-6 years doing Notes coding, none of the developers had any idea about profiling the LotusScript agents. I was amazed! If you do any LotusScript,coding, you will find that the profile is your best friend.
For Domino Designer 8.5.1 the selection is on the properties tab then select basic.
Now run the agent, then in Designer right-click on the agent and select View Profile Results. You will get a page with the list of class/methods and their total run time in the longest to shortest order. For the sample agent show below you can see going from using a database search to a ftsearch saved 30,000 micro-seconds. Now you go from having a slow agent to a fast agent and you get to learn what works and what doesn't.
wqoViewAll Profile
04/16/2007 08:49:30 AM CDT
Elapsed time: 38063 msec
Methods profiled: 22
Total measured time: 37582 msec
| Class | Method | Operation | Calls | Time |
| Database | Search | 1 | 31907 | |
| DocumentCollection | GetNextDocument | 289 | 5316 | |
| Database | OpenByReplicaID | 2 | 281 | |
| Document | [expandedname] | Get | 1451 | 31 |
| Log | LogAction | 4 | 16 | |
| DocumentCollection | GetFirstDocument | 1 | 16 | |
| Document | GetItemValue | 3 | 15 | |
| Session | CurrentDatabase | Get | 4 | 0 |
| Document | [expandedname] | Set | 4 | 0 |
| Database | Server | Get | 3 | 0 |
| Database | GetView | 2 | 0 | |
| View | GetDocumentByKey | 2 | 0 | |
| DocumentCollection | Count | Get | 2 | 0 |
| Database | Title | Get | 1 | 0 |
| Database | FilePath | Get | 1 | 0 |
| Agent | Name | Get | 1 | 0 |
| Session | CurrentAgent | Get | 1 | 0 |
| Session | GetEnvironmentString | 1 | 0 | |
| Session | GetDatabase | 1 | 0 | |
| Session | DocumentContext | Get | 1 | 0 |
| Log | OpenNotesLog | 1 | 0 | |
| Log | Close | 1 | 0 |
wqoViewAll Profile
04/19/2007 08:29:49 AM CDT
Elapsed time: 8297 msec
Methods profiled: 21
Total measured time: 7562 msec
| Class | Method | Operation | Calls | Time |
| DocumentCollection | GetNextDocument | 231 | 6030 | |
| Database | OpenByReplicaID | 2 | 578 | |
| Database | FTSearch | 1 | 344 | |
| DocumentCollection | GetFirstDocument | 1 | 234 | |
| View | GetDocumentByKey | 2 | 218 | |
| Log | LogAction | 5 | 126 | |
| Database | GetView | 2 | 16 | |
| Document | [expandedname] | Get | 1161 | 16 |
| Session | CurrentDatabase | Get | 4 | 0 |
| Document | [expandedname] | Set | 4 | 0 |
| Document | GetItemValue | 3 | 0 | |
| Database | Server | Get | 3 | 0 |
| DocumentCollection | Count | Get | 2 | 0 |
| Database | Title | Get | 1 | 0 |
| Agent | Name | Get | 1 | 0 |
| Session | CurrentAgent | Get | 1 | 0 |
| Session | GetEnvironmentString | 1 | 0 | |
| Session | GetDatabase | 1 | 0 | |
| Session | DocumentContext | Get | 1 | 0 |
| Log | OpenNotesLog | 1 | 0 | |
| Log | Close | 1 | 0 |
Comments (2)
Glulio
When I found out they didn't know about it, I updated the Domino Designer wiki and posted this. I usually find I use it when agents run slow or have an impact but I realize that any LotusScript agent should be checked first.
Don't forget to turn off profiling before you go to production!
Nice tip Bruce. The profiler is a grossly under-used performance monitor that developers should be aware of.
I have used it from time to time. But have to admit I don't use it as often as I should.