Concurrent Use in Asp.net Applications

Asked

Viewed 220 times

0

I’m starting to study programming in Asp.net mvc (and trying to follow the DDD) and, with this, I came up with a question regarding the concurrent use: Asp.net already performs this control for me or I am the one who should control it with Threads in everything that is method of my system (Controllers, data access, application layer, etc)?

  • 2

    Raphael, Good afternoon I suggest you read the link article below, which deals with Domain Driven Design (DDD) and how to use it on . NET Framework http://www.devmedia.com.br/introducao-ddd-em-net/32724

  • Thanks Jeordanebatista! very good article, but I’m more in doubt is to the same competing use.

  • 1

    It depends on the way you are programming, if you are creating statics object, you should do this control.

  • 2

    What exactly do you have in mind about concurrency control? The calls in controllers/actions? This is what Asp.net controls and IIS controls, now code stuff (like objects and lists in memory) you should implement.

1 answer

2


Your question is not very specific, I will try to answer taking into account what you most quoted (DDD and DAL).

There is competition control at the level of request, that is, requests Simultaneos has its own memory as a sandbox, they do not divide most states. An example of object that is divided is session.

Since Voce spoke more with focus on DDD and access to data (I imagine the bank), you have to do the control. Suppose you’re using the EntityFramework, Voce may have Simultaneos requests moving the same data, and this may be a problem.

Example: a reservation system, where user A can be with the seat window open, thinking where to sit. Meanwhile, user B also arrives on this screen and chooses seat 1. Coincidentally, user A also chooses seat 1 and fires the request along with user B, so that the 2 requests arrive on the server together. At this point, if your code does not treat competitive and simply execute User.MakeReservation(1) for both users, Voce will get data loss.

There are several ways to deal with this, such as pessimistic and optimistic competition.

At the level of threads and everything else, every request, most of the time, will have its space, and within this space Voce has to deal with such competitors.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.