IBM®
Skip to main content
    Country/region select      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     

developerWorks  >  Lotus  >  Forums & community  >  Best Practice Makes Perfect

Best Practice Makes Perfect

A collaboration with Domino developers about how to do it and how to get it right in Domino

One of the responders to my performance tips document mentioned using the Delete doc statement to clear NotesDocument objects out of memory as a way to improve performance by not gobbling up as much memory.

This is something I've advocated myself, but I've had email communication with another developer who was not convinced, and who did timing and memory tests that showed that using Delete actually had no effect on performance or memory usage.

I haven't had time to study these results in depth, but I did a little testing and didn't see any difference either, so I'm sort of halfway convinced that using Delete is a waste of time. Has anyone done any serious testing around this that does show a benefit? Is it possible that something changed in a recent version so that this no longer helps?

Andre Guirard | 26 June 2007 07:48:08 PM ET | Plymouth, MN, USA | Comments (7)


 Comments

1) Found Same Result
Rami | 6/26/2007 8:30:49 PM

I added this minor code change recently to an LEI Scripted Activity and found that processing 100k+ docs went from 1 hour to 61 mins! Basically no change so I did not pursue further.

2) Should it make a difference?
Rob McDonagh | 6/26/2007 10:01:07 PM

Hey Andre, have you asked the folks who maintain that section of code whether or not there *should* be any benefit? In theory, I mean. We'd still want to see test results to find out what the practical reality is, of course, but it'd be very interesting to know how well the result matches the developers' intention.

3) Mattered in R5, don’t think it does in ND6/7
Erik Brooks | 6/26/2007 10:24:15 PM

We refactored a monstrous script library a few years ago in R5, and we were hitting some memory problems that were alleviated with DELETE statements. The data structure generated in memory was more or less a tree of linked-lists.

We performed an experiment of very similar code under ND6, and didn't seem to see the same problem.

If I recall, the problem was that "touching" a doc in R5 consumed memory as the doc was loaded into Notes' cache. Touch 100,000 docs and you could chew up quite a bit of memory.

In ND6 (again- if I recall), the same thing would happen -- to a point. After awhile your memory usage would stop growing. It was as if Notes knew that its memory usage might cause paging, which completely defeats the purpose of the cache in the first place. Perhaps at that point it started cycling "old" docs out of the cache?

I'm with Rob @2, though -- somebody should know if there *should* be a change or benefit.

4) Ugh... Long day...
Erik Brooks | 6/26/2007 10:26:45 PM

I forgot to emphasize why all this cache talk mattered -- in R5 the memory consumption could get so high that things would start paging and performance would tank.

5) this fits what Rocky said at Lotusphere
Charles Robinson | 6/26/2007 11:32:03 PM

In my own experience it varies somewhat by platform. Using Delete made a tremendous difference when dealing with large sets of documents on a memory constrained iSeries running R5 then R6 through 6.5.4. On a high-end linux server with 6.5.4 then 7.0.2 it has made no difference at all. I haven't done extensive testing, but it seems that it's a factor of available resources and possibly a small amount of platform-specific differences.

As a side note, at Lotusphere Rocky said in one his sessions that Delete was only necessary because of a bug in R5. I know you have long advocated using Delete so I questioned Rocky after his session. He seemed certain this problem had been fixed in the R6 codestream so I tracked you down in the lab and asked you to follow up on this with Rocky. Rocky even responded to one of my blog postings and said he would address it with you.

Apparently none of that happened, but it looks like we're getting closer to a consensus nonetheless. :-)

6) LotusScript Garbage collector..
Wild Bill | 6/27/2007 3:05:44 AM

My understanding is that the Garbage collector within LotusScript is quite agressive - happily deleting out-of-scope "docs" during loops, etc, etc.

Unlike the Java implementation.

So - use delete in LotusScript ? Not unless your trying something *really* bad like keeping thousands of notesDocument objects open. Which is bad. IMHO, you should really be "sniffing" revelant information into a class object, capturing the noteID and reopening that document if more work needs to be done...

HTH,

---* Bill

7) I’m going to agree with Wild Bill on this one
Bob Balaban | 6/27/2007 8:37:42 PM

Explicitly deleting things in LotusScript is occasionally beneficial (like, if you know someone has externally updated a document you are currently referencing, and you want to refresh those updates in your LS program, you'd delete and re-acquire the Document), but otherwise why not let the garbage collector do its work? It's pretty good, it immediately de-allocates any variable that goes out of scope, and so on.

Of course, in Java you MUST use recycle() explicitly!

 Add a Comment
Subject:
   
Name:
Comment:  (No HTML - Links will be converted if prefixed http://)
 
Remember Me?     Cancel

Search this blog 

Disclaimer 

    About IBM Privacy Contact