如何在预订系统中处理多个用户并发 [英] How to handle multiple user concurrency in booking system

查看:118
本文介绍了如何在预订系统中处理多个用户并发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有包含网络,商业,数据的n层应用程序的电影票预订应用程序,并且我们在asp.net mvc api层.suppose 1000个用户同时请求预订同一个座位。阻止其他用户预订。我们是否应该在应用程序中包含一些其他组件。请指导我在架构方面的最佳解决方案。



我是什么尝试过:



检查数据库中更新的日期列,以便可以处理其他用户更新到数据库。但这不会处理并发。

There is movie ticket booking application of n-tier application which contains web,business,data,and we api layer in asp.net mvc .suppose 1000 of users make request at the same time to book the same seat .how to prevent another users from booking.Whether we should include some other component in the application.Please guide me the best solution in terms of architecture also.

What I have tried:

Checked with updated date column in database so that can handle another users from updating into database.but this not handles concurrency.

推荐答案

请在此处查看如何处理数据库并发性的答案: c# - 在数据库访问应用程序中管理并发的最佳方法是什么? - 堆栈溢出 [ ^ ]



此CodeProject文章:在.NET中进行锁定的6种方式(悲观和乐观) [ ^ ]



以下是 C#in a Nutshell 的作者的锁定机制概述:在C#中进行线程化 - 第2部分 - 基本同步 [ ^ ]
See the answer here how to handle database concurrency: c# - What's the best way to manage concurrency in a database access application? - Stack Overflow[^]

And this CodeProject article: 6 ways of doing locking in .NET (Pessimistic and optimistic)[^]

Here is an overview of locking mechanisms by the writer of C# in a Nutshell: Threading in C# - Part 2 - Basic Synchronization[^]


第一个用户将预订置于悬疑中。其他人被退回。



如果在5分钟后(例如)预订被确认(已确认付款),那么预订是保留,否则返回池(基于时间的触发器)。
The "first" user puts the "booking" in "suspense". The others get bounced.

If after 5 minutes (for example) the booking is "confirmed" (payment confirmed), then the booking is "reserved", else it is returned to the pool (time based trigger(s)).


这篇关于如何在预订系统中处理多个用户并发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆