How does asp.net handle concurrent user requests?

This is for looking for an answer to a question I ran into in the tech discussion.

There were 50 tickets available on the travel booking website. Now there is only one ticket left2. Users click on the web server at the same time as Asp.net can handle parallel requests.

1) How does asp.net handle these requests?

2) There is a way for one of the users to get the last ticket. What it is?

I think an in-depth understanding of asp.net architecture requires an answer to this question.

can someone give me some idea.

Thanks SNA

+3


source to share


2 answers


1) How does asp.net handle these requests?

Simultaneously.



2) There is a way for one of the users to get the last ticket. What it is?

This will depend on what you mean when you receive your ticket. If by getting a ticket you mean updating a field in your database and then in your database to handle it. If you are using transactions, this is probably the first SQL query that will trigger an UPDATE, which will succeed and the second will fail if you are using some kind of database-level constraint. But again, this will all depend on the specific implementation.

+4


source


In this case, you don't have to worry about the concurrency interface, IIS will take care of that for you. Much more important will be the correct database implementation with carefully chosen transaction isolation levels, deadlock handling, etc.



+2


source







All Articles