Even in C/C++, when you want to stream data, you have to do your
homework : serialize the structure. There is no easy and simple way to
flush a pointer, unless you just want to flush the address !

So basically, I really see no difference between C/C++ and JAVA when
it comes to serialize data and send them through a network, using a
protocol. This is the reason why some weird people are defining
protocols to transfert data...

If you are using Java, you have simple ways to serialize data, by
implementing the serializable interface : your objects will be
automatically serialized, using introspection (something you can't do
in C/C++). This won't be the fastest way to serialize data, but at the
end, it's order of magnitude faster than the timeit takes to transfer
data through the network anyways !

Hope it helps.

On 8/21/07, Jeroen Brattinga <[EMAIL PROTECTED]> wrote:
>
>  Well, I just use the (Mina) ByteBuffer (see
> http://mina.apache.org/report/1.1/apidocs/org/apache/mina/common/ByteBuffer.html)
> methods to get each field (e.g. getUnsignedInt, getString, getChar). I have
> one class that does the basic unpacking (header, CRC, payload size etc.),
> and some more specific classes that worry about the payload. I didn't find
> it cumbersome, although a struct would have been easier.
>
>  But now that it's implemented, I only deal with nice and easy message
> objects that contain the processed data (using the
> DemuxingProtocolCodecFactory).
>
>  Could you give a more detailed specification of one of your packets? It
> would give us some more insight into the problem.
>
>
>  Jeroen Brattinga
>
>
>
>  mat wrote:
>  The reason why I raised this thread is: recently I am really bothered with
> following issue.
>
> My mina component has to connect to a legacy server written in C++. C++
> server just simply sends out the struct as a message. I think for a C++
> program it is just simple return the struct pointer and use each field.
> However, to my java program that is a disaster(also really lower the
> performance). I have to use all the system.arraycopy to make up each
> field.(Actually it causes OOM). I don't know if you guys ever faced this
> kind of problem. How to solve it?
>
>
> On 8/11/07, Emmanuel Lecharny <[EMAIL PROTECTED]> wrote:
>
>
>  Hi guys,
>
> when guessing relative performances of Java/C++ on a network
> environment, please keep in mind that data processing will be
> processed orders or magnitude faster than simple network handling by
> the underlying layer. Thinking that Java is slower than C++ to handle
> messages on a network based application because it does not have
> pointers is out of base.
>
> FYI, I have tested our LDAP server on my laptop, sending Search
> requests through MINA (Apache Directory Server is based on MINA, 1.0.3
> version), and I got something like 5000 req/s (a request is around
> 1kb), assuming that almost all the time is spent internally to the
> server itself, not in the MINA layer. Btw, LDAP messages are binary,
> but that does not mean it's easier to decode them in C/C++ than in
> Java (I would say that the complexity is exactly the same for both
> languages).
>
> I don't want to start a flame war, but I encourage anyone who want to
> compare Java and C++ to compare things that are comparable, and not
> blind guess what can be slow or fast in both languages.
>
> My 2cts
> Emmanuel
>
> On 8/11/07, mat <[EMAIL PROTECTED]> wrote:
>
>
>  Actually the windows IOCP server is written in C++ and it is running on
>
>  a pc
>
>
>  server. I believe the reasons why Java can't reach that performance
> sometimes due to lack of structure(pointer). I find it is really
>
>  cumbersome
>
>
>  job to decode a binary message in Java. I don't know if you guys have
>
>  better
>
>
>  solution to decode the binary format and manipulate the each field in
>
>  the
>
>
>  binary message.
>
> On 8/11/07, Michael Grundvig <[EMAIL PROTECTED]> wrote:
>
>
>  I don't have the exact numbers but I know on a big Linux box (8
> processors,
> 8 gb ram) with a switched gigabit backbone we have seen greater then
> 45,000 - 50,000 messages per second sustained. Ultimately the problem
> becomes a matter of garbage collector churn rather then IO overhead.
>
>  On
>
>
>
>  Windows machines we could get only to a fraction of that. We believe
>
>  the
>
>
>
>  underlying I/O differences between Windows and *nix become really
>
>  obvious
>
>
>
>  when you get to higher message counts.
>
> Michael
>
> ----- Original Message -----
> From: "mat" <[EMAIL PROTECTED]>
> To: "dev" <dev@mina.apache.org>
> Sent: Friday, August 10, 2007 11:24 AM
> Subject: Mina throughput
>
>
>
>
>  Does anyone have the throughput test by raw socket communication
> (keep-alive
> mode)? My colleague wrote a windows IOCP server whose throughput
>
>  could
>
>
>
>
>  reach
> 1.8m/sec. (5000message/sec in intranet).
>
>
>
>  --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>
>
>


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to