Hi everyone, I'm having a performance problem with the JSPs in my applicaiton. During performance testing I found that my application's JSPs were using a little less then 80% of the heap in my JVM (and garbage collection is the bottle neck in my application's performance). I used JProfiler and it showed me that the majority of this memory was used by character arrays. Using my debugger in conjunction with the profiler it appeared that the memory was allocated as soon as the jsp file was loaded. I tried experimenting with different values to the buffer directive but it didn't seem to make any difference.
The relevant technolies used with this are Sun One Application Server 7, Java 1.4.2, and Struts 1.2.7 (the struts tags are used heavily on the pages).
If anyone can give me some advice on this or any insight on what the JSP might be using these character arrays for I would appreciate it.
You should try tuning your JSP and find out correct scope for your objects. After you are done with it, if it still gives you problem then find out if too many objects are created and destroyed. In this case you may use Parallel GC for aggressive garbage collection. If your objects are persisting for longer time, then you might need to figure out other ways of releasing these objects. For example: Say you are creating an ArrayList of 1 million objects and then you are traversing the objects in one pass. If you don't need an object after you move to the next object, then remove the object from the ArrayList so that these objects are subsequently available for garbage collection.
Hi Sunil, thanks for the response! I tried experimenting with the different GC methods available, but they didn't make much difference. Since the JSPs were using such a high percentage of the memory, what ever method I used still required too much work for the garbage collector.
The fact that my JSPs we absorb 3 quarters of the application's memory seems strange to me since the data that is being displayed was retrieved in java classes that are run before the JSP. I don't understand why the JSP requires so much more memory than my java class that containted the same application data.
Also, the memory is being used by character arrays, and thier usage appears to be far higher in the JSPs than in my application code, which makes me suspect that it is the JSPs (or the struts tags that I am using in them) that are generating these objects and not the data that is passed to the JSP.
Basically my question is, does anyone know why my JSP would be using so many more character arrays than my java application code?
I suggest try finding those character arrays (which can then eventually lead to struts tags) from the servlets generated from jsp. But as i see, you have ran a JProfiler and so you may lead yourself to the culprit tags that you loaded heavily. I can only suspect as i do not have the code
I didn't see many in the generated code, and I tried using my debugger to see at what step the memory was used, but JProfiler appeared to show that the memory was taken as soon at the first line of the JSP. Which was not a declaration of a character Array.