Performance problem


I’m writing an gallery application. I want to display about 12 images on Panel. There are buttons that let you navigate between images. I use FileResource to load image and Embedded to display it. My problem is performance because if I click the button that should display annother pack of 12 images I can notice that my computer is just freezed because the whole memory is occupied. Everything is running on Tomcat.

Do you know how can I avoid such a problems ?


Twelve images does not sound that much - unless they are really huge of course. Based on this hard to say what is causing this, but first thing you should do is to find out whether it is browser (rendering) or server (reading files) that is causing this. You can try that by running them in separate computers.

How long time this freezing takes or does it crash the whole application? Is there any error message shown in your standard output or in the log file? If a stack overflow exception is show in the logs the problem might be that your code has an infinite recursion call (that happens sometimes even for an experienced developer). Sometimes, tomcat might be configured to run with so little (heap) memory that it may help if you increase the heap size with jvm parameters like -Xmx512m