pwnage
pwnage
CC#
Created by pwnage on 1/19/2023 in #help
❔ Preventing over-allocation over limit in database with lots of concurrent requests?
Hey. I have a webapi controller endpoint, that calls another service, and it takes around 5-6 seconds for other service to calculate if success or fail. Based on success or fail, I would store the data in database. I have a limitation setting in my db on how many rows can be saved. For instance if limit is 50 people, it should allow only 50 successful people to claim a spot. It acts like first come first serve. Any suggestion on how to prevent over-insertion/over-allocation of rows over that maximum limit, if i have tons of users doing request at the same time? I was thinking about queue, but the problem is that, let's say 20 people are queuing and if 3rd service takes on average 5s to respond, the 20th in queue would wait 100 seconds for result.
6 replies
CC#
Created by pwnage on 10/2/2022 in #help
Drop composite PK and add new column PK with identity with EF Code first
3 replies