Asynchronous Socket Performance,

  • Thread starter Thread starter Anders Both
  • Start date Start date
A

Anders Both

In my application the fowing call:

workSocket.BeginSend(byteData, 0, byteData.Length,0, new
AsyncCallback(SendMesCallBack), null);

Takes between 156250 and 312500 Ticks . And when like 20 calls are made at a
time, they really sum up to something that I did not exspect att all.
Why does I exspirence this thing, is this normal ?
(I am 100% sure that the time is consumed by only this single line)

?
 
By the way, can this problem be related to that this thing is going on
inside the asp.net process.
 
Anders,

My guess is that it has something to do with the IO completion ports
that are allowed for the machine. I'm guessing that with ASP.NET using up
some threads in the thread pool for IO completion ports, as well as the
Socket class (which makes calls to WSARecv using IO completion ports, I
believe), you might be running low on resources.

I am curious, have you tried the numbers without using sockets
asynchronously?
 
If I comment out the workSocket.BeginSend part, there is no performance
problems at all. Then all numbers are just around 0 Ticks.

It is strange, I am lokking into it, right now. And will be contenniung
tuesday. More good idea and advice are wery welcome.

Best Regards.


Nicholas Paldino said:
Anders,

My guess is that it has something to do with the IO completion ports
that are allowed for the machine. I'm guessing that with ASP.NET using up
some threads in the thread pool for IO completion ports, as well as the
Socket class (which makes calls to WSARecv using IO completion ports, I
believe), you might be running low on resources.

I am curious, have you tried the numbers without using sockets
asynchronously?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Anders Both said:
In my application the fowing call:

workSocket.BeginSend(byteData, 0, byteData.Length,0, new
AsyncCallback(SendMesCallBack), null);

Takes between 156250 and 312500 Ticks . And when like 20 calls are made
at
a
time, they really sum up to something that I did not exspect att all.
Why does I exspirence this thing, is this normal ?
(I am 100% sure that the time is consumed by only this single line)

?
 
Anders,

I think you misunderstood. Instead of making a asynchronous call, how
is the performance if you make a synchronous call?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Anders Both said:
If I comment out the workSocket.BeginSend part, there is no performance
problems at all. Then all numbers are just around 0 Ticks.

It is strange, I am lokking into it, right now. And will be contenniung
tuesday. More good idea and advice are wery welcome.

Best Regards.


message news:[email protected]...
Anders,

My guess is that it has something to do with the IO completion ports
that are allowed for the machine. I'm guessing that with ASP.NET using up
some threads in the thread pool for IO completion ports, as well as the
Socket class (which makes calls to WSARecv using IO completion ports, I
believe), you might be running low on resources.

I am curious, have you tried the numbers without using sockets
asynchronously?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Anders Both said:
In my application the fowing call:

workSocket.BeginSend(byteData, 0, byteData.Length,0, new
AsyncCallback(SendMesCallBack), null);

Takes between 156250 and 312500 Ticks . And when like 20 calls are
made
 
I dont know that. But it would be a bit of work to change my server socket
into a synchronous socket, just to try it.

But but but, the latest news is that if I set:

Optimize Code to true,
and
run the project without debuging (in release mode),
(maybe this is the thing and the optimize code does not matter)

stuff seems to be much much much much better. But I am not still sure that
the problem is solved 100%.

I will come back here Thursday, (I cannot spell thesse days in English)

Best Regards. Anders Both, Denmark



If i set

Nicholas Paldino said:
Anders,

I think you misunderstood. Instead of making a asynchronous call, how
is the performance if you make a synchronous call?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Anders Both said:
If I comment out the workSocket.BeginSend part, there is no performance
problems at all. Then all numbers are just around 0 Ticks.

It is strange, I am lokking into it, right now. And will be contenniung
tuesday. More good idea and advice are wery welcome.

Best Regards.


message news:[email protected]...
using
up
some threads in the thread pool for IO completion ports, as well as the
Socket class (which makes calls to WSARecv using IO completion ports, I
believe), you might be running low on resources.

I am curious, have you tried the numbers without using sockets
asynchronously?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

In my application the fowing call:

workSocket.BeginSend(byteData, 0, byteData.Length,0, new
AsyncCallback(SendMesCallBack), null);

Takes between 156250 and 312500 Ticks . And when like 20 calls are
made
at
a
time, they really sum up to something that I did not exspect att all.
Why does I exspirence this thing, is this normal ?
(I am 100% sure that the time is consumed by only this single line)

?
 
Anders,


That will generally be a good idea. Generally speaking, you are going
to get better performance numbers if you are running code without debug
symbols in it.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Anders Both said:
I dont know that. But it would be a bit of work to change my server socket
into a synchronous socket, just to try it.

But but but, the latest news is that if I set:

Optimize Code to true,
and
run the project without debuging (in release mode),
(maybe this is the thing and the optimize code does not matter)

stuff seems to be much much much much better. But I am not still sure that
the problem is solved 100%.

I will come back here Thursday, (I cannot spell thesse days in English)

Best Regards. Anders Both, Denmark



If i set

message news:#[email protected]...
Anders,

I think you misunderstood. Instead of making a asynchronous call, how
is the performance if you make a synchronous call?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Anders Both said:
If I comment out the workSocket.BeginSend part, there is no performance
problems at all. Then all numbers are just around 0 Ticks.

It is strange, I am lokking into it, right now. And will be contenniung
tuesday. More good idea and advice are wery welcome.

Best Regards.


"Nicholas Paldino [.NET/C# MVP]" <[email protected]>
wrote
in
message Anders,

My guess is that it has something to do with the IO completion ports
that are allowed for the machine. I'm guessing that with ASP.NET
using
up
some threads in the thread pool for IO completion ports, as well as the
Socket class (which makes calls to WSARecv using IO completion
ports,
I
believe), you might be running low on resources.

I am curious, have you tried the numbers without using sockets
asynchronously?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

In my application the fowing call:

workSocket.BeginSend(byteData, 0, byteData.Length,0, new
AsyncCallback(SendMesCallBack), null);

Takes between 156250 and 312500 Ticks . And when like 20 calls are made
at
a
time, they really sum up to something that I did not exspect att all.
Why does I exspirence this thing, is this normal ?
(I am 100% sure that the time is consumed by only this single line)

?
 
Back
Top