wow there is so much wrong with this test,
First I find it hard to believe that you got up to 90% efficiency on a
transfer at all, network over head should have knocked down your transfer
more than that.
first are these the same machine
what other machines are on the network
how many times did you run each test (25 to 50 times is the standard where I
work, but we use automated tools to run and keep track)
what are you reading these speeds from?
if they are different machines, then when it comes to networks the protocol
is the last part to look at
and last none of the speeds listed are slow, for a small 20 meg file
3.75MBytes a second is not bad and may have more to do with Linux
keeping a
single packet size, while windows tries to adjust packet size for short
transfers.
On 6/14/07, Andreas Hund <[EMAIL PROTECTED]> wrote:
Hi,
is MONO network streaming slow?
First I built a very simple client/server program
to get a data stream over network.
In both programs I used a TcpClient,
a NetworkStream and a byte array (8kB chunks)
to stream 20 MB of data.
Then I tested the transfer rate of the client/server
program between different Linux/MONO (1.2.3.1)
and different Windows/.NET (2.0) hosts
in a 100 Mbit/s ethernet.
The strange result: If MONO was involved
the speed was dramatically reduced.
Only a .NET/.NET transfer showed a realistic
rate.
.NET --> MONO : 31...42 Mbit/s LOW
MONO --> MONO : 43...45 Mbit/s LOW
MONO --> .NET : 51...76 Mbit/s LOW
.NET --> .NET : 94 Mbit/s O.K.
What's wrong here?
Any suggestions or hints?
Thanks in advance.
Cheers
Andreas
=======================================================
Sourcecodes:
// ******
// Client
// ******
using System;
using System.IO;
using System.Net.Sockets;
namespace SimpleStreamClient
{
class SimpleStreamClient
{
public static void Main(string[] args) {
TcpClient client;
NetworkStream netStream;
byte[] buf = new byte[8192];
int bytesToReceive = buf.Length;
int receivedBytes = 0;
int bytesReceived = 0;
for(int index = 0; index < 10; index++) {
client = new TcpClient(args[0], 14866);
netStream = client.GetStream();
DateTime startTime = DateTime.Now;
bytesReceived = 0;
while(true) {
bytesToReceive = buf.Length;
while(bytesToReceive > 0) {
receivedBytes = netStream.Read(buf, 0, bytesToReceive);
if(receivedBytes == 0) {
break;
}
bytesReceived += receivedBytes;
bytesToReceive -= receivedBytes;
}
if(receivedBytes == 0) {
break;
}
}
double rate = bytesReceived / (((TimeSpan)(DateTime.Now -
startTime)).TotalMilliseconds * 1000) * 8;
Console.WriteLine(bytesReceived + " Bytes received (" + rate +
"MBit/s).");
}
Console.ReadKey();
}
}
}
// ******
// Server
// ******
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
namespace SimpleStreamServer
{
class SimpleStreamServer
{
public static void Main(string[] args) {
TcpClient client;
NetworkStream netStream;
byte[] bigBuf = new byte[20000000];
MemoryStream ms = new MemoryStream(bigBuf);
byte[] buf = new byte[8192];
string host = Dns.GetHostEntry(args[0]).AddressList[0].ToString();
IPAddress ipAddr = IPAddress.Parse(host);
TcpListener listener = new TcpListener(ipAddr, 14866);
listener.Start();
while(true) {
Console.WriteLine("Waiting for client ...");
client = listener.AcceptTcpClient();
Console.WriteLine("New client!");
netStream = client.GetStream();
ms.Seek(0, SeekOrigin.Begin);
int readBytes = 0;
while((readBytes = ms.Read(buf, 0, buf.Length)) != 0) {
netStream.Write(buf, 0, readBytes);
}
netStream.Flush();
client.Close();
}
}
}
}
--
View this message in context:
http://www.nabble.com/Why-is-MONO-network-streaming-slow--tf3921539.html#a11119438
Sent from the Mono - General mailing list archive at Nabble.com.
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list
--
William S. Huskey
UNIX Systems Engineer
Maritime Systems Solutions Division
SAIC
Tel: 425-267-5643
Email: [EMAIL PROTECTED]
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list