I am working on a basic Struts based application that is experience major spikes in memory. We have a monitoring tool that will notice one request per user adding 3MB to the JVM heap memory. Are there any tips to encourage earlier garbage collection, free up memory or improve performance?
The application is a basic Struts application but there are a lot of rows in the JSP report, so there may be a lot of objects created. But it isn't stuff you haven't seen before.
- Perform a set of database query.
- Create an serialized POJO object bean. This represents a row.
- Add a row to an array list.
- Set the array list to the form object when the action is invoked.
- The JSP logic will iterate through the list from the ActionForm and the data is displayed to the user.
Notes:
1. The form is in session scope and possibly that array list of data (maybe this is an issue).
2. The POJO bean contains 20 or so fields, a mix of String
or BigDecimal
data.
The report can have 300 to 1200 or so rows. So there are at least that many objects created.