Thursday, August 9, 2012

Extreme Stress Testing a Domino Server | Blog

Extreme Stress Testing a Domino Server | Blog:
Earlier this year I talked about OutOfMemory Java Exceptions I was experiencing. Now I find myself back in the position of writing Java Agents that could potentially leak memory and I'm still really non-the-wiser as to whether I'm clearing up after myself properly in my code.
The code I've written generates PDFs and both emails them and attaches to document. There are OutputStream, InputStreams, ByteArrays, Streams, MimeEntities not to mention all the Domino objects being used.
I've done my best to close, flush and recycle everything. But I'm still paranoid. I don't want to be responsible for killing no server.


Stressing Out


So, I've been stress testing the server. Big time. To do this I added a Page in the database and threw together the tool you see below, which lets me tell it which URL to stress test and when I press "Go" it makes a request for that URL once every second until I tell it to stop.
image
The output you see in the textarea is the JSON I got the Agent to return. The Agent does it's usual business of creating the PDF and storing in a document. It then returns some information about the JVM's memory usage. To do this the Agent ends with this code:
out.println("Content-Type: text/plain");
out.println("");
out.println("{\"memory\":"+
"{\"total\":"+Long.toString(Runtime.getRuntime().totalMemory())+
",\"free\":"+Long.toString(Runtime.getRuntime().freeMemory())+"}}");

I then left the Ajax code running and calling the code once a second. Overnight!
By the morning it had made 45,000 calls. Total Memory had fallen from 30.8MB to 18.4MB.
The "free" memory had fallen from a range of between 19mb to 400kb to a range of between 4.5mb to 500kb!!
I then left it running overnight again the next night (with no server respite or restarts). The next day the total memory had risen back to 25MB! Odd, huh?
So, although it looks like the total amount of memory available to the JVM fell overnight the first night, the server managed to regain some of it the next night.
The server is a fairly low-spec VM with 1GB of RAM running on Windows 2003.
server
I've been keeping an eye on the amount of memory the nhttp process is using up and it seems fairly consistent and not about to pop.


Heading For a Fall


Is what I'm seeing typical and expected? Or does the gradual fall in total amount of memory the JVM has mean that, at some point, it's going to break?
Anybody interested in this "tool". I'm not sure whether to make it more configurable and add charts etc. There are lots of powerful web server stress testing software out there, but they're all overkill for what I wanted.
Click here to post a response

DIGITAL JUICE

No comments:

Post a Comment

Thank's!