Re: Asynchronous socket programming vs. remoting
From: Michael Lindsey (mike_lindsey_at_alltel.net)
Date: 11/16/04
- Next message: MrNobody: "Please help! Need summary row for DataGrid"
- Previous message: Nicholas Paldino [.NET/C# MVP]: "Re: Calling user control from VBScript (managed and un-managed)"
- In reply to: Frank Hileman: "Re: Asynchronous socket programming vs. remoting"
- Next in thread: Frank Hileman: "Re: Asynchronous socket programming vs. remoting"
- Reply: Frank Hileman: "Re: Asynchronous socket programming vs. remoting"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 16 Nov 2004 15:50:27 -0500
Thanks Frank.
You are the first person that said I should use sockets.
The argument against sockets is usually "all the coding and maintenance"
that it takes to get it working well.
I decided to give it a try and got a real nice solution up and running
quickly, with surprisingly little code, using asynchronous network streams.
The performance is awesome! I am pulling images from FL to GA and loading
them quicker than I can load them from my harddrive using the file system.
It scales nice too - I tried throwing 400 requests at the server in a span
of 30 secs and it returned all images without a hitch.
I was pulling them at 129kb/s and that limitation is likely due to using DSL
over a VPN.
The processor usage during my test never went above 8% on a Pentium II 500
with 1 gig of ram.
The ram usage was at 10 mb but dropped back down to 2-3 mb after each test.
The threads got up around 100 during the test and dropped back down to 6
after the test. The extra threads were due to the asynchronous processing
and it was all handled by the system. I didn't have to create a single extra
thread manually.
Thanks for the advice.
Michael Lindsey
"Frank Hileman" <frankhil@no.spamming.prodigesoftware.com> wrote in message
news:uiJWIeyyEHA.2600@TK2MSFTNGP09.phx.gbl...
> Hello Michael,
>
> I have tried web services, remoting, and direct tcp/ip. Of the three I
> prefer tcp/ip (sockets):
>
> - web services are incredibly slow. This is not suprising, considering the
> xml processing. But it can go through a firewall. This would be the last
> choice for me. Useless for real-time data. In your case, you would have
> several layers of overhead: not just the http and xml parsing, but
> additionally conversion to and from base64 encoding. I imagine both your
> client and server will perform horribly.
>
> - remoting is ok but not as fast as tcp/ip. The other problem is the
strong
> typing -- you must have a copy of the remoted types on both machines.
>
> - .NET has fairly good support for simple tcp/ip. Performance is great.
You
> do not need the same assembly on the client and server. Instead, you
create
> your own protocol, whereby you decide beforehand on the encoding and order
> of data. Of the three this is the best, and in many ways the simplest, but
> you need an open port.
>
> I don't have a copy of a file sharing program. There is a basic TCP/IP
> real-time data communication and visualization program included in the
> VG.net samples, under the title Sockets. It uses asynchronous functions in
> .NET correctly; not using a separate thread per client, but rather the
> functions (BeginWrite/EndWrite/BeginRead/EndRead) that make use of the
> thread pool. TCP/IP programming this way is easy. Avoid online samples
that
> create a separate thread per-client, or try to roll their own thread pool
> from scratch. This is not necessary.
>
> Regards,
> Frank Hileman
>
> check out VG.net: www.vgdotnet.com
> Animated vector graphics system
> Integrated Visual Studio .NET graphics editor
>
> "Michael Lindsey" <mike_lindsey@alltel.net> wrote in message
> news:FJBld.966$Tu.834@fe39.usenetserver.com...
> >I need to write a server app to send images to client GUIs that are
outside
> > of the server's domain.
> > The client will have the file system path to the image but can not
access
> > the file system.
> > I am trying to decide if I should use remoting vs. writing a server that
> > uses networkstreams.
> >
> > I have read that networkstreams\tcp programming should be faster than
> > remoting and is a better choice for what I am doing but that it is
> > difficult
> > to code.
> >
> > I'd like to get
> > 1. a recommendation on remoting vs socket programming for what I'm
> > doing
> > and
> > 2. If socket programming is recommended ... the url of a full sample
of
> > an ansychronous server\client file sharing application.
> >
> > Thank you,
> > Michael Lindsey
> >
> >
> >
>
>
- Next message: MrNobody: "Please help! Need summary row for DataGrid"
- Previous message: Nicholas Paldino [.NET/C# MVP]: "Re: Calling user control from VBScript (managed and un-managed)"
- In reply to: Frank Hileman: "Re: Asynchronous socket programming vs. remoting"
- Next in thread: Frank Hileman: "Re: Asynchronous socket programming vs. remoting"
- Reply: Frank Hileman: "Re: Asynchronous socket programming vs. remoting"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|