473,722 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Monitoring asp.net async calls

Hi,
I implemented asynchronous calls to a web resource (using HttpWebRequest)
from asp.net 2.0.
The request it's made asyncronously (I see that beginGetRespons e returns
immediately).
The number of worker thread and completionPortT hreads are over 300.
Making 200 calls I see that 100 are queued.
There's a counter telling how much async calls are handled?
How can I raise the number of request handled?

Thanks in advance for your help

--
Carlo Folini
Feb 1 '07 #1
7 5076
the default settings only allow 2 concurrent connections to a web server
(proper net-etiquette). you need to bump these up. also iis has a max
number of open connections (MaxConnections ), you need to bump this up.
also network driver has a limit (MaxUserPort). you will need to bump
this up.
-- bruce (sqlwork.com)


Carlo Folini wrote:
Hi,
I implemented asynchronous calls to a web resource (using HttpWebRequest)
from asp.net 2.0.
The request it's made asyncronously (I see that beginGetRespons e returns
immediately).
The number of worker thread and completionPortT hreads are over 300.
Making 200 calls I see that 100 are queued.
There's a counter telling how much async calls are handled?
How can I raise the number of request handled?

Thanks in advance for your help
Feb 1 '07 #2
Hello Carlo,

For your scenario, if you're using the "BeginGetRespon se" to send http
request asynchronously at client-side, that means the client-side http
request calling is under asynchronous mode. At server-side, the ASP.NET
runtime engine will still treat each comming requests(from your
asynchronous client) as normal requests and process them synchronously.
Therefore, you can still use those standard performance counters to trace
the requests being processed. e.g.

=============== ===============
Requests Executing
The number of requests currently executing.

Requests Failed
The total number of failed requests. Any status codes greater than or equal
to 400 will increment this counter. Requests that cause a 401 status code
increment this counter and the Requests Not Authorized counter. Requests
that cause a 404 or 414 status code increment this counter and the Requests
Not Found counter.

Requests Succeeded
The number of requests that executed successfully (status code 200).
=============== =============== =

You can find more ASP.NET specfiic performance counters in the following
reference:

#Performance Counters for ASP.NET
http://msdn2.microsoft.com/en-us/lib...92(VS.71).aspx

BTW, are you performing some performance test against your ASP.NET
application? As Bruce has mentioned, by default each .net client has a
maxconnection limit(2) to given remote site(request from local machine
doesn't have this limitation). If your client app is sending request to
remote machine, you need to take care of this:

http://msdn2.microsoft.com/en-us/lib...ion.connection
managementeleme nt.maxconnectio n.aspx

Also, for ASP.NET server-side threading, since the <processModel>' s
"maxWorkerThrea ds" and "maxIoThrea ds" limit the concurrent threads of each
ASP.NET worker process, you can monitor your server machine's CPU
utilization. If the CPU utlization is still low and there are lots of
queued requests, that means you can still enlarge the max worker/io threads
number to improve your application's throughput.

Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 2 '07 #3
Hi Bruce hi Steven,
in my scenario the client is an ASP.NEt 2.0 aspx page and the server is a
SOAP toolkit isapi.
In my aspx page I'm creating the soap payload 'manually' and send it via
HttpWebRequest.
I'm stress testing this solution.
The IIS 6 serving aspx page under load takes 40% of CPU so I have plenty of
room to augment the number of concurrent requests.

I tweaked all the parameters you told me.
My question is about monitoring the asynchronous behavior of the aspx page.
When the aspx page send the request to the ws the processing is stopped and
put back in a IIS queue.
Is it this queue the same that handles the 'normal' requests? (i think it's
a different one? I call it 'async queue' to differentiate from the IIS normal
request queue)
Is there some perf counter to monitor how much request are inthe 'async
queue'?

I'm also calling different ws that behaves differently in terms of
performance (sometimes a subsystem gets slow). I need to separate the request
for the various subsystem (i use connectiongroup s to use different
connections).
In this scenario if a subsystem gets slow the request to the corresponding
ws remains queued in the 'async queue'. The IIS queue is free to serve the
other requests or the request limit cause the 'Server Too Busy' error?

--
Carlo Folini
"Steven Cheng[MSFT]" wrote:
Hello Carlo,

For your scenario, if you're using the "BeginGetRespon se" to send http
request asynchronously at client-side, that means the client-side http
request calling is under asynchronous mode. At server-side, the ASP.NET
runtime engine will still treat each comming requests(from your
asynchronous client) as normal requests and process them synchronously.
Therefore, you can still use those standard performance counters to trace
the requests being processed. e.g.

=============== ===============
Requests Executing
The number of requests currently executing.

Requests Failed
The total number of failed requests. Any status codes greater than or equal
to 400 will increment this counter. Requests that cause a 401 status code
increment this counter and the Requests Not Authorized counter. Requests
that cause a 404 or 414 status code increment this counter and the Requests
Not Found counter.

Requests Succeeded
The number of requests that executed successfully (status code 200).
=============== =============== =

You can find more ASP.NET specfiic performance counters in the following
reference:

#Performance Counters for ASP.NET
http://msdn2.microsoft.com/en-us/lib...92(VS.71).aspx

BTW, are you performing some performance test against your ASP.NET
application? As Bruce has mentioned, by default each .net client has a
maxconnection limit(2) to given remote site(request from local machine
doesn't have this limitation). If your client app is sending request to
remote machine, you need to take care of this:

http://msdn2.microsoft.com/en-us/lib...ion.connection
managementeleme nt.maxconnectio n.aspx

Also, for ASP.NET server-side threading, since the <processModel>' s
"maxWorkerThrea ds" and "maxIoThrea ds" limit the concurrent threads of each
ASP.NET worker process, you can monitor your server machine's CPU
utilization. If the CPU utlization is still low and there are lots of
queued requests, that means you can still enlarge the max worker/io threads
number to improve your application's throughput.

Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 2 '07 #4
Thanks for your reply Carlo,

Now we got that your httpwebrequests call(asynchrono us) are actually made
in the client ASP.NET web application. Yes, such asynchronous call will
significantly affect the ASP.NET runtime's workerthreads and application
throughput.

As you mentioned that you use HttpWebRequest. BeginGetRespons e to make
asynchrous method call, then after the call, have you block the thread to
wait for the response or just simply ignore the response(let it be a
one-way style method call)? If you doesn't block it and wait for the
response(call EndGetResponse) , the ASP.NET main workerthread will run as
normal and be returned to the threadpool after the page lifecycle end.
Also, asynchronous call such as HttpWebRequest. BeginGetRespons e(or any
other BeginXXX like call) will use threads from .NET managed thread pool.

Therefore, for your scenario, there are two operations that will consume
..net CLR thread-pool threads:

** the ASP.NET requests which need thread-pool thread to handle it

** your httpwebrequest' s asynchronous call is running in thread-pool
thread.

Thus, if your maxWorkerThread and maxIOThread is not configured to the
proper value, you may encounter thoughput bottleneck.

Actually, ASP.NET runtime/.NET runtime doesn't care whether your ASP.NET
page is using asynchronous call, from its viewpoint, it only care whether
your task need a thread-pool thread to process. If so, it pickup a thread
from pool to process it. So what you need to take care is the currently
available thread-pool threads. This s quite easy to get through the
ThreadPool class, and .net doesn't add built-in counter for this, you can
simply create a custom counter as below:

#How To: Monitor the ASP.NET Thread Pool Using Custom Counters
http://msdn2.microsoft.com/en-gb/library/ms979194.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 5 '07 #5
Hi Steven,
I didn't understand well what you are saying.

What I do on my aspx page is depicted in this post from Fritz Onion:
http://pluralsight.com/blogs/fritz/a...0/19/2892.aspx

I think that asp.net is aware of my async call.
When the "async point" is reached the aspx request is put back in the queue.
When the response from the ws come back the aspx request is picked up again
and handled by a (maybe different) worker thread to complete the rendering
phase.

Do you agree?

What it's not clear to me is where this aspx request is sent. Is it put back
in the http.sys queue or is the I/O thread pool managed by the .net runtime?

When I undertand this, I would like to know if there's a counter that counts
those async calls

--
Carlo Folini
"Steven Cheng[MSFT]" wrote:
Thanks for your reply Carlo,

Now we got that your httpwebrequests call(asynchrono us) are actually made
in the client ASP.NET web application. Yes, such asynchronous call will
significantly affect the ASP.NET runtime's workerthreads and application
throughput.

As you mentioned that you use HttpWebRequest. BeginGetRespons e to make
asynchrous method call, then after the call, have you block the thread to
wait for the response or just simply ignore the response(let it be a
one-way style method call)? If you doesn't block it and wait for the
response(call EndGetResponse) , the ASP.NET main workerthread will run as
normal and be returned to the threadpool after the page lifecycle end.
Also, asynchronous call such as HttpWebRequest. BeginGetRespons e(or any
other BeginXXX like call) will use threads from .NET managed thread pool.

Therefore, for your scenario, there are two operations that will consume
.net CLR thread-pool threads:

** the ASP.NET requests which need thread-pool thread to handle it

** your httpwebrequest' s asynchronous call is running in thread-pool
thread.

Thus, if your maxWorkerThread and maxIOThread is not configured to the
proper value, you may encounter thoughput bottleneck.

Actually, ASP.NET runtime/.NET runtime doesn't care whether your ASP.NET
page is using asynchronous call, from its viewpoint, it only care whether
your task need a thread-pool thread to process. If so, it pickup a thread
from pool to process it. So what you need to take care is the currently
available thread-pool threads. This s quite easy to get through the
ThreadPool class, and .net doesn't add built-in counter for this, you can
simply create a custom counter as below:

#How To: Monitor the ASP.NET Thread Pool Using Custom Counters
http://msdn2.microsoft.com/en-gb/library/ms979194.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 5 '07 #6
Thanks for your reply Carlo,

Well, now I've got your actual scenario. Previously, I misunderstood your
"async page", as you mentioned "BeginGetRespon se", I assumed that you're
using normal page request to call the HttpWebRequest. BeginGetRespons e to
perform asynchronous operation.

For Async page you used, yes, you're right, when the async execution
begin(after PreRender event and before PreRenderComple te event), the worker
thread(for processing the page) is release and put back to managed
thread-pool. However, here in the async execution, you use Httpwebrequest
to perform another asynchronous operation, and based on my experience, such
asynchronous httpwebrequest call will also consume .NET threadpool thread.
I've checked the reflectored code of HttpWebRequest. BeginGetRespons e, it
will check the current ThreadPool's available workerthreads and IO threads.
Therefore, what I would suggest you do is create a custom counter which
use the " ThreadPool.GetA vailableThreads " method to monitor the current
available worker threads and IO thread in your ASP.NET application
process's CLR thread pool(as the following articles mentioned). This is the
most important statistics that will determine your ASP.NET application's
throughput (if there is no available threadpool thread, all the sequential
comming requests will be queued).

#How To: Monitor the ASP.NET Thread Pool Using Custom Counters
http://msdn2.microsoft.com/en-gb/library/ms979194.aspx

If you find that there is no significant improvement after using
asynchronous page execution, I think that means the WebRequest call will
also consume thread-pool thread so that using asynchronous execution won't
help much here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.


Feb 6 '07 #7
Hello Carlo,

Have you got any further idea or progress on this issue? As mentioned in
the previous message, the ThreadPool statistics are the primary flag of
your web applciation's throughput status. If you still haven't been able to
get it work or the performance monitor result doesn't quite reflect the
application's real status, there may has something else that impact the
performance. If you need to further thorough troubleshooting , I would
suggest you consider contact CSS for continual support. Please feel free
to let me know if there is still anything we can help.

http://msdn.microsoft.com/subscripti...t/default.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Feb 8 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
10451
by: Vanessa | last post by:
I have a question regarding async mode for calling Microsoft.XMLHTTP object. Microsoft.XMLHTTP hangs the IE once in a while suddenly, but it will work again after half an hour or so without doing anything. I have searched through the Internet and seems like the reason it hangs the browser it's because XMLHTTP limits you to two concurrent HTTP connections to each remote host; so if more than 2 concurrent connections strike the script...
6
1934
by: Amy L. | last post by:
I am working on a project where I will have a ton of async DNS calls in a console application. I would like to process the results of the Aync calls on the same thread that made the async call. Now I was looking at the Async WaitHandle options. They are "WaitOne", "WaitAny", and "WaitAll". I would like to process all of the results that are returned. However, due to network performance and other factors not all of the results are...
1
1836
by: Claire | last post by:
We've had problems with a third party dll that communicates over a network and would like to be able to monitor each function call. We thought of using a 2nd thread which would log an alert if the 1st thread didn't emerge from a dll function call within a certain timeout period What I need to know is if all application threads hang while one is stuck or if they will keep running nevertheless. thanks
11
6964
by: ryan | last post by:
Hi, I've omitted a large chunk of the code for clarity but the loop below is how I'm calling a delegate function asynchronously. After I start the each call I'm incrementing a counter and then making the main thread sleep until the counter gets back to zero. The call back function for each call decrements the counter. Is there a better way to make the thread wait until all calls are complete besides using the counter? I've seen some things...
1
4325
by: Simon Hart | last post by:
Hi, I thought I'd just open a thread in an attempt to get peoples feelers with regards to multithreading vs Async Web Service processing. Of course Web Services makes it easy to do Async method calling, but what if you are already in a worker thread in a Windows Forms application when doing the web service call. In this case there is no need to use Async Begin..End features that .NET kindly presents us with.
6
3823
by: Shak | last post by:
Hi all, Three questions really: 1) The async call to the networkstream's endread() (or even endxxx() in general) blocks. Async calls are made on the threadpool - aren't we advised not to cause these to block? 2) You can connect together a binaryreader to a networkstream:
7
2859
by: Shak | last post by:
Hi all, I'm trying to write a thread-safe async method to send a message of the form (type)(contents). My model is as follows: private void SendMessage(int type, string message) { //lets send the messagetype via async NetworkStream ns = client.GetStream(); //assume client globally accessible
0
1023
by: Kursat | last post by:
Hi, We have a network monitoring application wich generates some messages at unpredictable times. Our Windows Forms based client applications grab these messages and show them our clients. We want to build a web based architecture to implement same logic. We want our clients to watch monitoring messages on their browser window. I focused Ajax and async web service calls but I also see that clients can call a web service method...
1
1973
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... There are a few questions wrapped up in this, but the main one is that the WebService.MyMethodAsync() methods that are automatically generated in the client code by VS 2005 don't seem to be finishing for me. We have a VS add-in written in .net that used to make a number of database calls to fill forms. To improve security, we moved the db calls to a web service and return DataSets for the calls (the result sets are always...
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8739
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9238
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4502
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.