views:

388

answers:

2

Hi to all,

this is my first post here, i hope to find someone that can help to clarify my doubts!

I'm developing a server in C#. This server will act as a data server for a backup service: a client will send data, a lot of data, continuously, specifically will send data chunk of files, up to five, in the same tcp channel. I'll send data to the server slowly, i don't want to kill customer bandwidth, so i didn't need to speed up at max data send and, for this reason, i can use a single tcp channel for everything.

Said this, actually the server uses BeginReceive method to acquire data from client and, on windows, this means IOCP. My questions is: how BeginReceive will perform on linux/freebsd trough mono? On windows, i've read a lot of stuff, will perform very well but this software, the server part, will run on linux or freebsd trough mono and i don't know how these methods are implemented on it!

More, to try to reduce continue allocations of an Async State object for the (Begin|End)Receive method i mantain one for the tcp connection and in the BeginReceive callback i copy out data before reuse it (naturally i don't clear data in because i know how much read trough EndReceive return value). Buffer is set on 8kb so i'll at max copy out 8kb of data, it shouldn't kill resoruces.

My target is to get up to 400/500 connections at max. It isn't so much, but the server (machine), in the meantime, will handle files trough an own filesystem (developed using fuse first in C# and later in C) on LVM+Linux Software Raid Mirror and antivirus check using clamav so the software must be light as can!

EDIT: i forgot to say that the machine will be (probably) a Intel Core 2 Duo 2.66+ GHz (3 MB L2 - FSB 1066 MHz) with 2 GB of ram and the SO using 64 bits.

Is mono using epoll (libevent) or kqueue (on freebsd)? And i should do something specific to try to maximize performances? Can i do something more to don't kill resources receiving data packets?

Thank you!

+1  A: 

I can't speak specifically about the performance of that one function on mono, but in general mono performs very well these days. 4-500 connections is as you say, not very many, so I doubt you'd have any issues.

In saying that, it shouldn't be very hard to set a test for this kind of thing up. I think that's probably the only way you'll get a conclusive answer for your situation.

Orion Edwards
Thank for your suggestion! I wrote a simple stress software that is capable to setup a set of connections while sending data, it's really simple. Testing my server on windows with 3000 simultaneous connections showed that my server would handle around 250 connections, but i think that this depends on my client machine (the one running the stress software) because is an old centrino 2ghz with 1gb of memory (= it can execute only one thread at time).I need to do some fixes, but this afternoon i'll try this stuff on my linux test machine!
daniele_dll
+2  A: 

I know it's a little late, but I just found this question...

Mono is able to handle the number of connections that you need and much more. I regularly test xsp2 (the Mono ASP.NET standalone server) with over 1k simultaneous connections.. If this is going to be a high load situation, you should play a bit with setting MONO_THREADS_PER_CPU until you find the right number of threads for the ThreadPool.

On linux, Mono uses epoll when available (which is always these days).

Gonzalo
Answers are never late :) Really thanks!
daniele_dll