transmitting XML files vs. binary data

Discussion in 'C++' started by Aleksej, Sep 7, 2006.

  1. Aleksej

    Aleksej Guest

    Hi All,

    When two processes located at different nodes communicate with each other,
    the interface of the communication can be implemented in two ways:

    1) as a protocol; the data are defined as program structures and sent
    finally as binaries.
    2) as exchange of XML files; the data are defined in text files by means of
    XML syntax and sent as strings.

    How could you compare the performance of these two approaches?
    I would go for XML files but I'm afraid that this can slow down the
    communication. Is it so?

    Thanks a million!

    A.
    Aleksej, Sep 7, 2006
    #1
    1. Advertising

  2. Aleksej

    Moonlit Guest

    Hi,

    Sending over text files is of course a lot more overhead. However it is also
    much easier to debug. It all really depends if you can afford the overhead.
    - How fast is the network
    - How much data

    You could compress the data with the zlib library and extract it at the
    other site (this is quite easy to do) and will usually greatly reduce
    textfiles..
    http://www.zlib.org

    Regards, Ron AF Greve

    http://moonlit.xs4all.nl

    "Aleksej" <> wrote in message
    news:edq73i$cts8s$-saarland.de...
    > Hi All,
    >
    > When two processes located at different nodes communicate with each other,
    > the interface of the communication can be implemented in two ways:
    >
    > 1) as a protocol; the data are defined as program structures and sent
    > finally as binaries.
    > 2) as exchange of XML files; the data are defined in text files by means
    > of XML syntax and sent as strings.
    >
    > How could you compare the performance of these two approaches?
    > I would go for XML files but I'm afraid that this can slow down the
    > communication. Is it so?
    >
    > Thanks a million!
    >
    > A.
    >
    Moonlit, Sep 8, 2006
    #2
    1. Advertising

  3. Aleksej wrote:

    > 1) as a protocol; the data are defined as program structures and sent
    > finally as binaries.
    > 2) as exchange of XML files; the data are defined in text files by means
    > of XML syntax and sent as strings.
    > How could you compare the performance of these two approaches?


    What do you mean by "program structures sent as binaries" ? Send the data in
    the native format for int, float... in the platform used?

    And by a protocol? If you are referring to send over the net from program to
    program instead of sendig files, you can use one method or the other
    equally with binary data or with xml or any other text format. But you say
    "sent as strings"... confusing.

    In order to compare the performance, even in theory, you must clarify what
    you intend to do in both cases. Or even better, program it and measure the
    performance.

    --
    Salu2
    =?ISO-8859-15?Q?Juli=E1n?= Albo, Sep 8, 2006
    #3
  4. Aleksej

    BigBrian Guest


    > When two processes located at different nodes communicate with each other,
    > the interface of the communication can be implemented in two ways:
    >
    > 1) as a protocol; the data are defined as program structures and sent
    > finally as binaries.


    "Protocol" doesn't necessarily imply binary data. TCP is a network
    protocol, and you can use it to send text as well as binary data.

    > 2) as exchange of XML files; the data are defined in text files by means of
    > XML syntax and sent as strings.


    XML doesn't have to be the only text format.

    > How could you compare the performance of these two approaches?


    uh, by taking measurements of quantities that are specified in your
    requirements. How would you compare the performance? I'm guessing
    that you don't plan to, and just plan on posting to inappropriate
    newsgroups and asking people who have no idea what your requirements
    are for their opinion.

    -Brian
    BigBrian, Sep 8, 2006
    #4
  5. Aleksej wrote:
    > Hi All,
    >
    > When two processes located at different nodes communicate with each other,
    > the interface of the communication can be implemented in two ways:
    >
    > 1) as a protocol; the data are defined as program structures and sent
    > finally as binaries.
    > 2) as exchange of XML files; the data are defined in text files by means of
    > XML syntax and sent as strings.

    Why limit yourself to only two ways?
    A defined protocol and ASCII are much more efficient than XML.

    >
    > How could you compare the performance of these two approaches?

    Implement simple processes that communicate with each other using
    the protocols. Start a timer, run for over a million iterations.
    Repeat with other protocols. Make sure to use lots of data in
    the communications so you can get better quality of data.

    > I would go for XML files but I'm afraid that this can slow down the
    > communication. Is it so?

    With XML, you are trading portability for efficiency. Binary formats
    are very efficient, but not portable. Even when porting, issues
    such as Endianism will slow it down.

    >
    > Thanks a million!
    >
    > A.
    >
    >



    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c -faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.comeaucomputing.com/learn/faq/
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
    http://www.sgi.com/tech/stl -- Standard Template Library
    Thomas Matthews, Sep 9, 2006
    #5
  6. "Aleksej" <> writes:

    > When two processes located at different nodes communicate with each other,
    > the interface of the communication can be implemented in two ways:

    [cut: 1. binary protocol; 2. XML]
    > How could you compare the performance of these two approaches?


    By benchmarking clients using each protocol...

    > I would go for XML files but I'm afraid that this can slow down the
    > communication. Is it so?


    I would go for binary protocol unles you are going to transmit
    floating point values as converting floating point variable to
    platform independent binary reprezentation may be troublesam; or you
    want to allow direct user interaction using telnet in which case
    I would go for an ASCII protocol.

    --
    Best regards, _ _
    .o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
    ..o | Computer Science, Michal "mina86" Nazarewicz (o o)
    ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--
    Michal Nazarewicz, Sep 10, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Franck

    transmitting eventHandler pb

    Franck, Sep 7, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    1,743
    =?Utf-8?B?UGF1bCBEIE1jTQ==?=
    Sep 7, 2005
  2. qqq111
    Replies:
    19
    Views:
    1,154
    Roedy Green
    Mar 1, 2006
  3. Qu0ll
    Replies:
    5
    Views:
    800
    Roedy Green
    Nov 23, 2007
  4. Clint O
    Replies:
    16
    Views:
    638
    Flash Gordon
    Feb 25, 2010
  5. hhp

    Http error 404 on transmitting big data

    hhp, May 23, 2008, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    139
Loading...

Share This Page