473,657 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2093
Hi Tumur:

On Fri, 1 Jul 2005 17:10:01 +0900, "Tumurbaata r S."
<sp********@mag icnet.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
"Tumurbaata r S." <sp********@mag icnet.mn> wrote in message
news:uU******** *****@TK2MSFTNG P15.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
2494
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 System.Net.Sockets about multiple sockets on the same port. This happens even with a single listener in multiple Win32 processes. Will I get better results by using a Socket instance with BeginAccept? Should I run multiple threads, or do the asynchronous...
2
412
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 need to make it support multiple instances) TIA
1
1578
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 service was already installed. Do I have to copy to a new location? Thanks. Gary Ivy
5
2486
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 this execution... we need immediate execution of all notification processes and would prefer to spawn multiple instances generating emails at one time. Solution ? I took a look at threading, and at first it looked to be the answer.
2
2316
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 process as being a problem. Potentially, one thread may crash and could bring down the whole process, including all the other threads. Using one process per thread seems more independent. This is similar to what happens when you open multiple...
4
1972
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 an example of multiple threads synchronized to use a single shared resource? -- Gregory Gadow
10
4973
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 Instance needs to run in its own process. My current approach to this is to put all the logic into a separate "Worker" assembly and install it into the GAC. I'm then going to create Multiple Windows Services (i.e. MyService1, MyService2 etc..)...
11
4333
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 conflicting views and far from ideal solutions. My application has to send small amounts of data about 50bytes to multiple client applications. The catch is that this has to happen about 1000 times a second. My first attempt was .net remotting...
19
6332
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 can all access. It seems like a needless waste of memory to make them all maintain their own copy of the same data in RAM at the same time. What's the best way to achieve this? I've heard of memory mapped files, so maybe that's the answer. ...
0
8306
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
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7327
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
4152
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...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
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.