[quoted text, click to view] 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.