Java Agent Speed/Memory

I’ve been given working on a project to take document file attachments and upload them to Content Manager running on an AS400/iSeries. Some of these attachments are multipage tiff files coming in from a fax server (Rightfax). Some of the requirements are that for some of these tiff files, only some of the pages may be related to certain index information in Content Manager. The various steps for my application are once the user has chosen the file attachment to process and which index class in Content Manager it is for, I need to present them with a GUI for them to preview of the document, allow them to enter the index information for the document (or selected pages), validate the index information entered against data on the AS400, and once this data is valid, upload the attachment (or split the file into the selected pages if required), and update a database file on the AS400 with the index information.

I’ve got all this done. I’ve created a number of java classes to do the whole process using a third part Java IDE (which is friendlier for creating the java), and am now bringing the process into Notes to be run (initially as an agent call), but possibly using Uselsx “*javacon” and calling the whole java process from Lotusscipt.

It works in Notes, but the process that splits the tiff file into it’s multiple pages (one for a scrolling thumbnail pane in the GUI) and a second for a much larger view of each individual page so the user can find some of the index information on the pages takes a very long time when it runs from the Notes client, versus running it from the Java IDE. In the IDE, the splitting and generating the images to use in the GUI takes about 7 to 10 seconds, but in Notes, it is more like a minute or more (if I don’t get an out of memory error - that I never get in the IDE)

Anyone else have issues with speed / memory running Java agents in Notes? Any thoughts or suggestions. There is really too much code to start posting, but any general suggestions would be appreciated.

Thanks, and sorry for going on in detail about the process/problem.

Henry

Subject: Java Agent Speed/Memory

Hi

Since you are running 7.02 I would try setting the parameter in notes.ini

JavaEnableJIT=1

to use Just-In-Time compilation. Compile the agent and try again. You should see a performance boost

brgds

Jesper Kiaer

http://www.jezzper.com

Subject: RE: Java Agent Speed/Memory

Jesper

Holy !$%&!@

I think it’s running faster now that it does in my Java IDE.

I did a bit of googling of this setting and on the page on the lotus site Ask Professor INI - Java/CORBA and JVM variables(see link IBM - United States ), has the following

By default, Notes disables the JVM default JIT (Just-In-Time) functionality because of its instability (see the caution below). Setting this variable to 1 turns on the default JIT functionality, if one is provided; so the JVM will allow normal loading of the default JIT. The variable’s syntax is:

JavaEnableJIT=1

Caution: JIT functionality can be unstable and lead to unexpected crashes.

It seems to work fairly well. Do you have any comments regarding their warning? I’ve written a number of java agents over the last few years, and I’m thinking I’ll re-compile them all if they would see that type of performance boost. Does that need to be set in the all users/servers notes.ini also (for scheduled agents on the server), or only for the design client compiling the java?

I’ll let Lotus support know about this. I wonder what they’ll say about it.

Thanks again.

Henry

Henry

Subject: RE: Java Agent Speed/Memory

Just got off the phone with Lotus support regarding the PMR I had opened on this issue. They’re glad to hear that the problem seems to be fixed by using this notes.ini setting and sad they were not the ones to suggest it. The indicated that most JVM’s use JIT, but not the one on the Notes client or server. They have not heard of any issues by using this setting in the ini, so I’ll probably roll this out to all our clients (have a number of client run java agents) and start out with our primary application server to see if it has any impact.

Thanks again to all who offered some advice. To those out there using java in Notes, I’d recommend using this ini setting.

Subject: RE: Java Agent Speed/Memory

Hi

Glad it fixed the speed problem! :slight_smile:

The comment about “unstable” has been there for years (and years), when the java version was 1.1.x . Since 7.0.2 is using JVM 1.4.2 my guessing is that it is much more stable now. Take the chance and see how it runs …if it unstable just turn the parameter off again.

brgds Jesper Kiaer

http://www.jezzper.com

Subject: Java Agent Speed/Memory

So I played a bit with some Notes.ini settings.

I added JavaMaxHeapSize=536870912 which is (512MB) - the default I think is 64MB. This allowed me to at least run the agent multiple times without running out of memory, but it is still very slow performing the image splitting (jar file from Imagero.com).

I also added JavaStackSize=819200 - which I believe is double the default, but it didn’t seem to have any apparent effect on the speed.

Anyone have any other suggestions?

Subject: Java Agent Speed/Memory

Starting the JVM is a bigger hit than the script engine which is tightly integrated. The Java classes are wrappers around C/+±API objects so they are slower however it ain’t that bad so long as you mark them to be recycled on every iteration. Rather than calling Java code from LotusScript do the lot in Java.

In a process such as you describe I’d expect to gain something using Java.

Subject: RE: Java Agent Speed/Memory

Gerry

Thanks for the response.

I haven’t even started actually integrating this with any Domino objects. At this time it is all being done as a java agent that uses a number of java script libraries and a couple of jar files (one included in the script library - the image processing one, and the jt400.jar - which I’ve got listed in the javauserclasses ini setting).

I’ve opened a PMR with Lotus to see if there’s anything I’m missing. I’ll post an update when they get back to me.

In the mean time, I’m going to use the Lotusscript “Shell” to call the java that way. It responds as well as it did in my Java IDE. The only down side is now my java is running outside of the Notes client so in order to get back and try to do anything with the notes document that contained the original file that I’m trying to work with, I’d have to pass the server, database and document information to my java methods and have them establish a connection back to Notes. I’m not planning on doing that at this time. I’ll see what Lotus support comes back with.

Henry

Subject: say that again…

did you say you are shelling out to lauch a Java IDE to do some stuff?

No wonder you are having problems!

It sounds like a (EPO?) lash up solution to overcome a people problem - either not having people who can do Java and Domino or the two groups don’t talk to each other.

BTW the use of javauserclasses is deprecated. You should deploy jars in the \jvm\lib\ext folder

Gerry_King at waco dot co period uk

Subject: RE: say that again…

I don’t think I said that. I did most of the programming of the java code in a third party IDE (JCreator) as the designer client doesn’t have some of the nicer features built into other java IDE’s. Testing in this IDE would load the gui window and all the pieces in around 10 seconds (the bulk of that time splitting the multipage tiff file into a thumbnail and 80% full size view that is used in the GUI). When I brought that code into lotus agents/script libraries and tried to run it I was getting a very poor response time to the part of my application the was processing the tiff file (between 1-2 minutes for the same tiff file). If the speed issue wasn’t able to be resolved when running it as a Notes java agent, I was looking into shelling out to call the java classes I wrote that would run in the JVM of the computer I was running it on rather than the JVM of the Notes client. With the JavaEnableJIT=1 ini setting solving the speed issue, I won’t have to go down that route.

Thanks for the heads up on the javauserclasses being deprecated. I think that’s the first time I’ve ever heard that.

Since I’m our java programmer and our domino programmer, I hate talking to myself as people tend to think your crazy when you do that :slight_smile:

Subject: Java IDE

don’t think I said that.

A misunderstanding on my part.

the designer client doesn’t have some of the nicer features built into other java IDE’s

If you are not overly attached to JCreator have a look at Eclipse and get the Domiclpse plugin http://www.domiclipse.com/

As you probably know the next version of the Designer is going to be based on Eclipse. If you can afford $29 MyEclipseIDE is a well crafted bundle of Eclipse plugins.

Gerry