How to send data from webservice

  • Thread starter Thread starter CSharper
  • Start date Start date
C

CSharper

Hi,

This may be off topic but for sure someone will able to help me. I
have a web service that return 1MB data. When I ran the client it took
10 sec to get the data but when I checked the server side it took only
1 sec to build the data. Is there a way I can send the data much
faster? Where is this 9 sec overhead coming from?

Thanks a lot.
 
CSharper said:
Hi,

This may be off topic but for sure someone will able to help me. I
have a web service that return 1MB data. When I ran the client it took
10 sec to get the data but when I checked the server side it took only
1 sec to build the data. Is there a way I can send the data much
faster? Where is this 9 sec overhead coming from?

The network? Over a LAN, 1MB/sec should be easy to achieve (that's
about 10Mb/s, which is at the low end for Ethernet; most networks are
running at 100Mb/s or 1Gb/s), but a slow wireless LAN or over the
Internet, it's possible to see slower.

It also depends on how the data is being sent. Sending only 1MB as a
single operation should be quick. But interaction between server and
client can add latency to the operation, as each end has to wait for a
response from the other and then provide its own response. Also,
sending 1MB as a plain binary stream should be quick, but if you're
using a protocol that reformats the binary stream somehow, the size of
the data could increase by quite a lot, which of course would take
longer to send.

And of course, if it takes 1 second to build the data and 1 second to
transmit the data, then that's 2 seconds for the client to wait.

Really, there are lots of possibilities. It's impossible to say for
sure where the time is taken without more details.

Pete
 
The network?  Over a LAN, 1MB/sec should be easy to achieve (that's
about 10Mb/s, which is at the low end for Ethernet; most networks are
running at 100Mb/s or 1Gb/s), but a slow wireless LAN or over the
Internet, it's possible to see slower.

It also depends on how the data is being sent.  Sending only 1MB as a
single operation should be quick.  But interaction between server and
client can add latency to the operation, as each end has to wait for a
response from the other and then provide its own response.  Also,
sending 1MB as a plain binary stream should be quick, but if you're
using a protocol that reformats the binary stream somehow, the size of
the data could increase by quite a lot, which of course would take
longer to send.

And of course, if it takes 1 second to build the data and 1 second to
transmit the data, then that's 2 seconds for the client to wait.

Really, there are lots of possibilities.  It's impossible to say for
sure where the time is taken without more details.

Pete

Thanks a lot Pete. You are right it has lot of variables. I was
expecting 1MB to come back less than 3 or 4 seconds. I will try to
research on each of those items you have specified.
 
This may be off topic but for sure someone will able to help me. I
have a web service that return 1MB data. When I ran the client it took
10 sec to get the data but when I checked the server side it took only
1 sec to build the data. Is there a way I can send the data much
faster? Where is this 9 sec overhead coming from?

Is this 1MB of data the RAW data or have you already accounted for the XML
bloat that will be added on top of the actual data?
 
Using IIS? If so, turn on compression and see if that makes a
difference. Or compress the data in your code (with something like
DeflateStream) before sending it.
 
Back
Top