0
votes

I am stress-testing a domino java agent which modifies potentially many documents in potentially many databases. I am load-testing the agent with huge databases and my agents are being shut down by the agent manager as they last longer than the specified input in the server document 'Max LotusScript/Java execution time:'.

I am aware that I can write a program document to let the agent run without any timing but don't want to do this since you lose the handle to the agent.

I am aware that I need to program the agent so that I can save the 'task' document (which contains all the instructions for the agent) in an 'unfinished' state so that I can start from where I stopped.

Writing LotusScript agents, there was a possibility of writing cleanup code in the 'Terminate' event of the agent, and I am missing this option for my java agent.

At the moment my best idea is to have a 'timeout' field in my configuration, which would be filled by a value smaller than the server cut-off time. This would imply, however, that I would be asking at very regular intervals the question 'Do I still have time to start the next action?' which I assume is going to kill the performance.

What's your experience with best practise for this case?

1
The admins for this project are conservative and I wanted the agent to be part of the nsf. But as a last resort I could consider it. Also thought of doing a Domino Server Task, but rejected it for the same reason. Cheers in any case.Andrew Magerman
Try adding a protected void finalize() method to your agent class. Not sure if it will work, but it's worth a shot. Theoretcially, the JVM calls finalize() when the object goes out of scope (i.e. is available for garbage collection), but whether it will actually be able to do anything at that point is the big question.Richard Schwartz
Hmm, Richard, there is actually no guarantee that finalize is ever going to run (this is the case in any java environment) so I'm not too keen on using it.Andrew Magerman
That's true, and that's a risk, which is why I've never tried it ;-) There is, of course, no guarantee that a timer will hit either, as a server hang or crash could prevent that.Richard Schwartz

1 Answers

0
votes

Apart from DOTS and a Java Application approach, here are two other alternatives.

Option 1: This is where you want to use a program document and still have some visibility to interact with your agent.

Add checks in your code to check either a file on disk or a document field. If the file is there, or field set then tell your application to start cleaning up.

There would be more overhead on checking a document then checking a file on disk.

Option 2: You can use a java.util.Timer object.

Have this set to execute for ServerMaximumTimeout - X minute/s. In the timer code throw a TimeoutException. Have your main code catch this Exception and do the clean up.

Then in your finally block clean up the timer object if it hasn't died yet.

More details on this in another question.