users@glassfish.java.net

Excessive memory usage in Toplink essentials JPA

From: <glassfish_at_javadesktop.org>
Date: Mon, 08 Sep 2008 07:16:48 PDT

I have an app that uses JPA and I've run into a rather nasty issue when returning large amounts of data. In particular, the data I am returning includes a number of one to many relationships so the returned dataset is a fairly large list of rows with embedded collections. I am returning roughly 25,000 rows with nested Vectors pointing to a small number of related dataset for each row reflecting the one to many relationships. Overall the amount of returned data is about 1.5MB in size.

The issue is not with Toplink or JPA at all. It is with returning that data to a fat client via an RMI call. The client connects to the Glassfish server, gets an intial context then looks up the EJB stateless session bean using a JNDI lookup. The call gets made, the data successfully get's looked up, I force the lazy fetches to complete and get a full and complete and correct data tree returning as a List<datatype>.

The problem is with the serialization engine that packages that list for sending back to the client. Even though there is only about 1.5MB of data, JProfiler shows over 6GB! of Char[] and Byte[], as part of the ObjectOutputStreams being used to transfer the data around!! whats up with that??? Any ideas?
[Message sent by forum member 'dawebsterup' (dawebsterup)]

http://forums.java.net/jive/thread.jspa?messageID=297819