Can someone explain to me how IIS works. (In term of worker process, thread, atomic, or how iis server deal when 1 user or concurrent user make a request from browser)? I don't need code but I need some explanation and guide.
Currently, I am designing e-commerce project. I need to draw information from database and assign uniquely. What I unsure off whether IIS process 1 user request at a time. Or IIS can process multi user concurrently at such those concurrent user might draw same information and boom web application crash.
ps for my broke english and grammer
I'm not a fan of Microsoft technologies, as such I will answer to my best capability for general web servers design pattern. My knowledge is basically in the Apache Web Server, Nginx and similar web servers. However even so IIS is not a new technology, as such shouldn't deviate much from the rest except those event base systems.
IIS is a multi-threaded web server in Microsoft platform. Like a multi-process or even multi-threaded Apache Web server, it can serve concurrently multiple requests made to the server.
Generally the design of a web server is the parent process/thread will listen to a designated TCP socket, primarily running on ports 80(HTTP) and/or 443(HTTPS). This parent process will block for incoming TCP connection. Once a connection is established, it will pass the socket to either another process or another thread for serving the request.
Below is a simple spawning new client process or thread to serve one client
Offloading each web request to the slave is how a generic TCP server makes it possible to multiple requests concurrently. The above is a very simple and naive approach and do not exactly explain how IIS does it internally.
But I'm pretty sure no one will ask you for the innards of IIS since it is a close source to start with, and I don't think it is of particularly high interest to a lecturer to ask for such details. So just answer from a generic multithreaded web server will suffice.
Access to the database is more tricky, it is not exactly the job of IIS, but rather the scripting language responsibility. Since IIS is a multithreaded web server, as such, there is likely not more than 1 ASP.NET engine running at any time. That is not true for multi process design for in unix systems. However each web request should have a different request context and the same ASP.NET engine will run each context differently in its own space.
Access to the database by the ASP.NET engine will depends on the driver you are using and what kind of databse you are accessing. Modern database will normally support connection pooling. In connection pooling, connections to the database are shared across multiple web requests one at a time. Since each pool will have multiple database connections, the connection pool system will manage these connections, allocating one at a time to web requests threads. Each thread must return the connection back to the pool after use and it will be given to another thread. Within each database connection, there is a notation of session. Within each session, there could be one or more database transactions.
It is the responsibility of the web application design to ensure shared resource management. Database transaction and locking mechanism will ensure consistent access most of the time, but it is ultimately the job of the web application to govern the consistency across the whole application.
Most likely it will not crash when shared data are not access properly with exclusiveness when required, but you will likely get inconsistent output.