|
|
|
start date: Wed, 01 Aug 2007 07:42:27 -0700,
posted on: microsoft.public.dotnet.framework.performance
back
| Thread Index |
|
1
unknown
|
|
2
ajk
|
|
3
Andre Kaufmann
|
BeginSend Performance
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 ?
Date:Wed, 01 Aug 2007 07:42:27 -0700
Author:
|
Re: BeginSend Performance
On Wed, 01 Aug 2007 07:42:27 -0700, AlexArl@gmail.com wrote:
>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 ?
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.
Date:Thu, 02 Aug 2007 21:43:06 +0800
Author:
|
Re: BeginSend Performance
AlexArl@gmail.com wrote:
>[...]
> Anyone knows why async sends are so slow ? And what to do if I don't
> want to open thread per client ?
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.
Andre
Date:Wed, 15 Aug 2007 07:08:20 +0200
Author:
|
|
|