使用 Linq 向数据库发送多个帖子
如果我有 2000 个网络用户,每个用户同时通过网站相同的表向 sqldb 提交帖子,linq 会毫无问题地处理这个问题吗?
if i have two thousand webusers each sumbmitting a post to sqldb through website at the same time same tables, will linq handle this without any problems?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您在每个请求中创建一个新的数据上下文,它将像任何其他方法一样处理它。 如果您确实有两千个并发请求,我不相信它们实际上会同时得到服务 - 假设您以正常方式使用 ASP.NET,我怀疑您无论如何,线程池中的线程都会耗尽。
您预计会出现什么样的问题? 显然,需要应对正常的数据库并发问题 - 处理并发更新等。LINQ to SQL 使检测和处理这些问题相对容易,但我强烈建议您获得一本合适的书来指导您完成该过程。
Assuming you create a fresh data context in each request, it'll handle it just as well as any other approach. If you genuinely have two thousand concurrent requests, I don't believe they'll all actually be served at the same time anyway - assuming you're using ASP.NET in a normal way, I suspect you'll run out of threads in the threadpool anyway.
What kind of problems were you anticipating? Obviously there'll be the normal DB concurrency problems to contend with - handling concurrent updates etc. LINQ to SQL makes it relatively easy to detect and handle these, but I strongly recommend that you get a suitable book to guide you through the process.