We want to time how long certain actions run for in an ASP.NET MVC application. We're using ActionFilters to start and stop a timer each time a contoller action is invoked. The result is a small dataset a bit like this:
我们想要计算ASP.NET MVC应用程序中某些操作运行的时间。每次调用控制器操作时,我们都使用ActionFilters来启动和停止计时器。结果是一个小数据集,有点像这样:
{
ContollerName: 'Account',
ActionName: 'Index',
ExecutionDuration: 287,
TimeRecorded: '2009-07-02 17:34:54'
}
We want to beam this data off to a Web service so that we can collect and later analyse it. For example, we could find out that Account/Index is the slowest action in the application.
我们希望将这些数据传输到Web服务,以便我们可以收集并稍后对其进行分析。例如,我们可以发现帐户/索引是应用程序中最慢的操作。
The thing is, if we're getting 1,000 requests per second, making 1,000 service calls per second isn't very clever; it will harm application performance.
问题是,如果我们每秒收到1,000个请求,那么每秒拨打1,000个服务电话并不是很聪明;它会损害应用程序性能。
Is there any way of doing buffered service calls? Or are there any libraries out there for doing this? Or is our architecture all wrong!?
有没有办法做缓冲服务电话?或者有没有任何图书馆可以做到这一点?或者我们的架构都错了!?
Thoughts appreciated.
2 个解决方案
#1
I don't usually just link answers to questions here, but the guy at whiletrue.com did a really good job of profiling MVC here. His slide show covers just about everything he did to set it up.
我通常不只是在这里链接问题的答案,但是whiletrue.com的人在这里对MVC进行了很好的分析。他的幻灯片放映了他所做的所有事情。
#2
You could create a controller with an action that can take those four values and simply hit your own site and in that controller queue up the information to a database. Then have a different process batch submit the information to you web service.
您可以使用可以获取这四个值的操作创建一个控制器,只需点击您自己的站点,然后在该控制器中将信息排队到数据库。然后有一个不同的进程批量提交信息给您的Web服务。
#1
I don't usually just link answers to questions here, but the guy at whiletrue.com did a really good job of profiling MVC here. His slide show covers just about everything he did to set it up.
我通常不只是在这里链接问题的答案,但是whiletrue.com的人在这里对MVC进行了很好的分析。他的幻灯片放映了他所做的所有事情。
#2
You could create a controller with an action that can take those four values and simply hit your own site and in that controller queue up the information to a database. Then have a different process batch submit the information to you web service.
您可以使用可以获取这四个值的操作创建一个控制器,只需点击您自己的站点,然后在该控制器中将信息排队到数据库。然后有一个不同的进程批量提交信息给您的Web服务。