Sockets, Performance, Messaging, NetworkStream
- From: Arthur M. <ArthurM@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 29 Apr 2005 13:14:02 -0700
If anyone can help that will be much appreciated.
I have implemented async socket server & client, functionally both work
well, when connected through loopback, performance is reasonably good. The
issue comes when i run the software over the network while functionally it
remains stable, performance wise it begins to suffer. I suspect it has
something to do with buffering, although I cant seem to pin point where :)
Initially I have worked directly with sockets, i.e. socket.beginread
socket.begin write etc..
Then I added the NetworkStream object, assuming that it will do the first
line of buffering and then actually write the data into the socket. The
situation improved but not by much.
One of the rules is that a message needs tobe delivered to the other side as
soon as it is completed, which means I can not use buffered stream and wait
for the
buffer to fill up.
message class:
MessageHeader Header;
byte[] data;
end message class
Send function (sync write) pseudo code:
byte[] message_header = header2bytes(currentmessage.messageheader)
socket (or networkstream).Write(currentmessage.header)
socket (or networkstream).Write(message.data)
reader function is async read
I suppose I lack the true understanding of what the purpose of NetworkStream
class is (other then being able to chain crypto and other streams why would
anyone use it?)
If anyone has anything coherent on the subject - please let me know.
Current performance is about 8 messages per second where server sends to
client and client sends it back
Message size is 84 bytes (with header)
Network 100 mb full duplex
MTU 1500
network latency 25 microseconds (just an L2 switch)
cpu utilization on systems running server and client is below 1%
as a side note, if i increase message size to 5k i get the same message rate
:)
tia
.
- Follow-Ups:
- RE: Sockets, Performance, Messaging, NetworkStream
- From: Arthur M.
- RE: Sockets, Performance, Messaging, NetworkStream
- Prev by Date: Re: Inlining.
- Next by Date: RE: Sockets, Performance, Messaging, NetworkStream
- Previous by thread: Problem: OutOfMemoryException thrown
- Next by thread: RE: Sockets, Performance, Messaging, NetworkStream
- Index(es):
Relevant Pages
|