简体   繁体   English

如何在 asp.net web api 中每秒处理 1000 个并发用户请求

[英]how to handle 1000 concurrent user requests per second in asp.net web api

We are working with web API to handle a 1000 concurrent user request per second.我们正在与 web API 合作,以每秒处理 1000 个并发用户请求。 We are hitting the API through the console application.我们正在通过控制台应用程序访问 API。 we have getting message 500 internal server error.so how we can handle the concurrent user request smoothly?我们收到消息 500 内部服务器错误。那么我们如何才能顺利处理并发用户请求?

(Adding a case -- In 100 hits - 98 hits are pass(200- ok) and 2 are fail- error 500. all time same parameters? (添加一个案例 - 在 100 次点击中 - 98 次点击通过(200- ok),2 次失败 - 错误 500。所有时间相同的参数?

You need to keep your main attention on 2 things - on asp.net and database side.您需要将主要注意力集中在两件事上 - 在 asp.net 和数据库方面。

While developing asp.net application for such scenario you might find it useful to use asynchronous controllers/pages (http://msdn.microsoft.com/en-us/library/ee728598(v=vs.100).aspx ) to optimize the load on your server and ensure that website will cope with multiple requests without huge delays.在为这种情况开发 asp.net 应用程序时,您可能会发现使用异步控制器/页面(http://msdn.microsoft.com/en-us/library/ee728598(v=vs.100).aspx )来优化负载很有用在您的服务器上,并确保该网站能够处理多个请求而不会造成巨大延迟。 Another important thing to consider is the caching layer - you can load the questions at the very beginning and cache them, in turn minimizing the time for accessing your pages.另一个需要考虑的重要事项是缓存层——您可以在一开始就加载问题并缓存它们,从而最大限度地减少访问页面的时间。

Also, you should carefully think about your database side and you might find it useful to utilize query hints (READPAST, NOLOCK, ROWLOCK) and design the tables in a smart way.此外,您应该仔细考虑数据库方面,您可能会发现利用查询提示(READPAST、NOLOCK、ROWLOCK)并以智能方式设计表很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM