Groups | Blog | Home
all groups > dotnet performance > august 2007 >

dotnet performance : BeginSend Performance


AlexArl NO[at]SPAM gmail.com
8/1/2007 7:42:27 AM
Hi,
I am benchmarking our server now.
Scenario:
5 clients, 1000 data entities distributed to them per second, 141K
around 700K per second.
Clients sit on the same LAN as server, all on separate computers.

I have two different implementations:

A) Reads are done asynchronously, using BeginRead, writes are done
synchronously using Send, from dedicated threads - sends to every
client are handled from separate thread dedicated.

B) Reads are done asynchronously as before, and writes are done
asynchronously, using BeginSend. No threads are created for clients.

In both cases data generation is done asynchronously to sends -
generated data is put to queue (separate for each client), and is not
slowed down by communication problems.

Protocol (the same in both cases) is
Send 20 bytes (header), then Send data (around 140 bytes). all this
1000 times per second per client, 5K times total.

Except differences in sending, all stuff is the same.

..Net 2.0, C#. debug build.

Variation A works as expected - no disconnections, CPU is around 5%.
Variation B - no disconnections, CPU is around 30%.

Anyone knows why async sends are so slow ? And what to do if I don't
want to open thread per client ?
ajk
8/2/2007 9:43:06 PM
[quoted text, click to view]

As a comparison we use traditional tcp/ip socket for our app, today we
ran a performance test with 100,000 updates/sec (one update is ca 50K
of data) and had around 30% CPU load on server. The method was similar
to your B, async read/write but not using .NET.
Andre Kaufmann
8/15/2007 12:00:00 AM
[quoted text, click to view]

Hi,
do you have perhaps a high number of context switches ?

(Use Performance Monitor - perfmon - or Process Explorer
(http://www.microsoft.com/technet/sysinternals/default.mspx) to view the
number of context switches.

AddThis Social Bookmark Button