473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Multiple threads or app instances?

ASP.NET QuickStart Tutorial says that:
....
ASP.NET maintains a pool of HttpApplication instances over the course of a
Web application's lifetime. ASP.NET automatically assigns one of these
instances to process each incoming HTTP request that is received by the
application. The particular HttpApplication instance assigned is responsible
for managing the entire lifetime of the request and is reused only after the
request has been completed. This means that user code within the
HttpApplication does not need to be reentrant.
....
A Note on Multiple Threads

If you use objects with application scope, you should be aware that ASP.NET
processes requests concurrently and that the Application object can be
accessed by multiple threads....
To make this code thread safe, serialize the access to the Application
object using the Lock and UnLock methods.
....

What do all above mean? ASP.NET/IIS launches multiple web applications for
every
request/session or one application (which starts when first request comes)
with multiple threads where each thread is responsible for each
request/session?
Nov 19 '05 #1
2 2080
Hi Tumur:

On Fri, 1 Jul 2005 17:10:01 +0900, "Tumurbaatar S."
<sp********@magicnet.mn> wrote:

What do all above mean? ASP.NET/IIS launches multiple web applications for
every
request/session or one application (which starts when first request comes)
with multiple threads where each thread is responsible for each
request/session?


No, ASP.NET doesn't launch an application for every request.
HttpApplication is a poor choice for the name of the class - it
doesn't really represent an 'application'. ASP.NET will create a bunch
of these objects, and keep them in a 'pool', and each time a request
arrives one will get pulled out of the pool and associated with the
request.

I have some more information in an article, with additional links at
the bottom:
http://odetocode.com/Articles/89.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #2
one application (which starts when first request comes)
with multiple threads where each thread is responsible for each
request/session? Actually, one application object. The threads are not owned by the
application object. The threads belong to the application pool which is
owned by the CLR (50 threads per cpu i believe). 1/2 of these threads are
responsible for servicing http requests.

The re-entrancy part has to do with the fact that an IIS request is
guaranteed to be serviced by one httpapplication instance - a queue. So
there is no need to protect against concurrent access.
If you use objects with application scope This really isn't related to the http/IIS request portion of the
explanation.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
"Tumurbaatar S." <sp********@magicnet.mn> wrote in message
news:uU*************@TK2MSFTNGP15.phx.gbl... ASP.NET QuickStart Tutorial says that:
...
ASP.NET maintains a pool of HttpApplication instances over the course of a
Web application's lifetime. ASP.NET automatically assigns one of these
instances to process each incoming HTTP request that is received by the
application. The particular HttpApplication instance assigned is
responsible for managing the entire lifetime of the request and is reused
only after the request has been completed. This means that user code
within the HttpApplication does not need to be reentrant.
...
A Note on Multiple Threads

If you use objects with application scope, you should be aware that
ASP.NET processes requests concurrently and that the Application object
can be accessed by multiple threads....
To make this code thread safe, serialize the access to the Application
object using the Lock and UnLock methods.
...

What do all above mean? ASP.NET/IIS launches multiple web applications for
every
request/session or one application (which starts when first request comes)
with multiple threads where each thread is responsible for each
request/session?

Nov 19 '05 #3

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

Similar topics

2
by: Paul A. Steckler | last post by:
I need to write a TCP/IP server in C# that can handle multiple connections. My first try was to use TCPListener instances in multiple .NET threads. Of course, I got an exception from...
2
by: Nigel | last post by:
Has anyone got any links to sites, articles etc or can help with how to write a Windows service that supports multiple instances in the way that MS SQL does? (I have an existing service and just...
1
by: garyivy | last post by:
I have written a .net windows service in vb. net. I now want to run "multiple versions of it". I changed the the servicename and the displayname in the service installer. I ran it. It said the...
5
by: Jeremy | last post by:
I have a core VB service that monitors a database, and based on data in the records will execute code to send email notifications. Problem: I don't want my main program code to halt and wait for...
2
by: Brett | last post by:
What are the advantages/disadvantages of using one process with multiple threads or doing the same task with multiple processes, each having one thread? I see using multiple threads under one...
4
by: Gregory Gadow | last post by:
I've cobbled together a PrinterClass that takes a text file and dumps it to a printer. The app using is has multiple threads, all of which need access to a shared instance. Can someone point me to...
10
by: John | last post by:
I currently have a Windows Service that runs Transactions that are very Processor/Memory Intensive. I have a requirement to deploy multiple instances of the Web service on the Same server. Each...
11
by: Olie | last post by:
This post is realy to get some opinions on the best way of getting fast comunication between multiple applications. I have scowered the web for imformation on this subject and have just found...
19
by: Zytan | last post by:
I want multiple instances of the same .exe to run and share the same data. I know they all can access the same file at the same time, no problem, but I'd like to have this data in RAM, which they...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.