温莎城堡拦截机的性能
正如许多人所建议的,通过 AOP 可以更好地管理日志记录,在我的例子中,使用 Castle Windsor 拦截器。
我目前正在开发一个 Web 应用程序,我们刚刚添加了一个拦截器来记录调用的每个方法(这些方法由自定义属性标记,因此我可以选择我想要记录的方法)。当我测试网络应用程序时,性能很糟糕。有时,页面渲染可能需要长达 10 秒的时间。如果没有拦截器,页面会立即加载。
添加拦截器和性能时是否有任何提示,或者实际上这么慢?
As suggested by many, logging is better managed through AOP, and in my case, using Castle Windsor interceptors.
I am currently developing a web app and we just added an interceptor to log every method that is called (the methods are tagged by a custom attribute therefore I can choose the method I want to log). When I test the web app the performance is awful. Sometimes it might take up to 10 seconds for a page to render. Without the interceptor the pages load instantly.
Are there any tips when adding interceptors and performance or is it actually this slow?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了解决方案。我执行了测试用例,启用拦截器后性能差异很小。我检查了我的 log4net 配置,发现我启用了 NH Profiler。我删除了分析器,性能猛增。分析器工作时似乎发生了一些奇怪的事情。
为了确保我的情况没有问题,我启用了 ATM 并打开/关闭了探查器。当分析器打开时,性能下降非常严重。当分析器关闭时,一切都很好。
Found the solution. I executed my test cases and the performance difference was minor with the interceptors enabled. I checked my log4net configuration and I saw that I had NH Profiler enabled. I removed the profiler and the performance sky rocketed. It seems that there is something strange going on when the profiler is working.
Just to make sure my case is fine, I enabled ATM with profiler on/off. When the profiler was on the performance degradation was HUGE. When the profiler was off everything was fine.