Object Encoder and Decoder Query
Frederic Bregier
fredbregier at free.fr
Sat Dec 27 13:45:35 EST 2008
As far as I understand, ObjectDecoder includes the FrameDecoder itself
so you don't have to worry about it, even for huge object.
The only thing I've got in my mind : what is huge object for you ?
What I mean is : take care of "Out Of Memory Exception"...
For instance, let say a server accept a thousand of clients.
Each client will send a 1 GB object (1 GB is not too big for one JVM).
But then for Server, it will be 1000 GB of memory at once ;-(
If it is a file transfer, perhaps splitting the file in several parts
would be a good idea.
If it is not a file transfer, so a real object, then it depends on the
kind of objects.
However, whatever how you split, I think going to the disk could be the
only solution.
FrameDecoder could be used to simplify the way you wrote to a disk...
If you don't split yourself the sending of the "huge" object,
FrameDecoder will not help you either since it will not prevent you of OOM.
Like ObjectDecoder, FrameDecoder will keep in memory every thing until
it gets
all the data it needs to pass to your handler, so the 1000 GB in my
previous example...
In fact, about OOM, it is not completely true, in Netty you have the
possibility
to handle the memory usage so that it prevents a lot of OOM. However my
feeling
is that in the previous example (1GB by 1000 clients) it will be of no
use except
race condition.
It is of course out of the scope of Netty, since it is a "business"
approach of your problem
that will answer your question...
HTH,
Frederic
manish_iitg (via Nabble) a écrit :
> Yes.
>
>
> I was only asking weather FrameDecoder is in build in the ObjectDecoder.
> Like, if i send a huge object over the network using ObjectEncoder and
> ObjectDecoder do i have to worry about using FrameDecder or not.
>
>
>
> Hi,
>
> The decoder should. If you look at the code, the encoder first puts
> the length of the
> object so that the decoder can take care of it when it receives the
> packets
> so that it makes the assembly correctly (like FrameDecoder).
>
> But for the encoder, what do you mean by packet fragmentation?
> If you mean the tcp/ip fragmentation, it is not at the level of netty
> (tcp/ip
> is under the wood) as a sender. But it is at the decoder part (as I
> wrote,
> the decoder take care of the multiple packets from tcp/ip stack).
>
> If you mean fragmentation of an object, it is at your level
> (splitting a big object into several smaller objects), so before Netty,
> but then you have to take care too after the decoder since you will
> receive several objects and not only one.
>
> Does this answer your question?
> Frederic
>
> manish_iitg wrote:
> Does object encoder and decoder also take of packet fragmentation
> and assembly issue.
>
>
>
>
> ------------------------------------------------------------------------
> This email is a reply to your post @
> http://n2.nabble.com/Object-Encoder-and-Decoder-Query-tp2012986p2016309.html
> You can reply by email or by visting the link above.
>
-----
Hardware/Software Architect
--
View this message in context: http://n2.nabble.com/Object-Encoder-and-Decoder-Query-tp2012986p2016458.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list