I have a tomcat/apache/mysql based system where the most of the usage is users on the site searching for other users. Previously, if a user search returned large amount of results, we would display a subset of the results and when the user clicked "next" or "prev" the search query would be run again but display the next (or prev) subset. This turned out to be too much of a hit on the db.
The solution we are using now is to have the search results return an array of user ids (of type long) and that array is stored in the session with a key based on the search parameters. So you execute the query once and grab the array from the session when you page through the results.
Now it seems our new scheme is putting a tremendous strain on
Tomcat. It doesn't seem to be running out of memory so one of our engineers thinks it is due to garbage collection. I'm not sure if this makes sense, but I don't have any really good arguments against it either. Should having a large number of arrays of longs stored in sessions create that much of a performance problem? These arrays are never have more than 2000 user ids in them, so memory doesn't seem like it would be an issue. Are there possibly jvm parameters that might improve garbage collection performance? Or is storing stuff in the session with tomcat just a very resource intensive thing even if the objects being stored are not very large?
Thanks....