Erwin ([EMAIL PROTECTED]) wrote:
> Hi guys,
>
> I was reading through Design patterns for the Pet Store.
>
> They say 2 contradictory things:
>
> 1) Value objects are unsuitable for Large objects. When you need to send
> back a large list, it is better to model each *row* as a value object
> instead of the entire list.
>
> 2) The CatalogEJB in PetStore source code returns a ListChunk type, which
> contains the entire list of objects.
>
> The explanation for the first was something like: Serializing large objects
> takes so much time that it overshadows the savings of network latency.
>
> I really don't know what to do now. Should I proceed with large objects, or
> should i chop them up?
> Any advice or suggestions will be truly appreciated
> Thanks
>
> -Erwin
I'm in no way an expert on these matters, barely even knowledgeable,
but I'll try my hand at an analysis until the pros show up Monday. I
imagine that the serialization cost is the same no matter how you
do it, you have to serialize all the data and you have to de-serialize
it all! If there are additional penalties for serializing in smaller
chunks I guess someone will inform us.
Depending on the size of your list, it might go in a single packet
if sent as a ListChunk. If the list is bigger than the maximum
packet size for your TCP link, unless you're very lucky and the size
of one row is exactly the maximum size for a packet, you'll send
more packets if you send one row at a time. Each packet has
to go through the usual Ethernet and TCP problems of potential
collisions and lost packets -- minimizing the number of packets sent
seems like it's the name of the game.
If you need all the elements of the list, my guess is sending the
ListChunk makes more sense. Now if you don't need all the elements
of the list, things clearly get a lot messier ;)
Gary
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".