为 WCF 服务定义 SLA [英] Defining SLAs for WCF Services

查看:32
本文介绍了为 WCF 服务定义 SLA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须对一堆相互依赖的服务进行性能/负载测试.它们都使用 net.tcp 并且大多数使用双工合同和内部排队.[handrolled POCO 队列类使用 lock(syncRoot) { if(queue.Empty) Thread.Wait();}]

I have to performance/load test a bunch of interdependant services. They all use net.tcp and most use duplex contracts and internal queueing. [handrolled POCO queue class using lock(syncRoot) { if(queue.Empty) Thread.Wait(); }]

这是我想出的方法:

  1. 确定要进行性能测试的 WCF 服务
  2. 确定每个服务的相关性能计数器
  3. 确定将通过正在测试的服务执行的逻辑起点
  4. 使用 VS.Net 为每个服务自动生成单元测试
  5. 编写特定的功能测试(例如,我可以使用一个用例 - 下订单" - 并编写测试来对相关服务进行所有调用,并且通常会练习几乎所有需要的功能)
  6. 使用运行 #5 的跟踪文件生成单元测试 [使用来自 CodePlex 的 WCF 负载测试](在我看来,这似乎是在调试环境中重新创建生产/现场用户错误的理想工具.免责声明:未使用工具.阅读项目说明的印象)
  7. 可以调整上述测试以使用自动生成的输入数据进行调用
  8. 为输入引入变体,以便练习不同的代码路径
  9. 来自性能计数器的日志数据
  10. 分析和识别瓶颈

问题:

  1. 有更好的方法吗?
  2. 对于使用内部队列的服务,使用标准性能计数器测量性能是一个问题.我可能需要自定义计数器?
  3. 如果 #1 为真,有没有办法在不更改被测试服务的代码的情况下引入客户计数器?
  4. 我应该关心功能测试的结果吗?
  5. 有没有办法[非侵入性地] 为 WCF 服务实施 SLA?(我认为如果我的计数器有足够的数据,例如服务的请求、发生的异常、响应时间等,我应该能够验证我的 SLA - 在 5 分钟内提供 200,000 个请求,每个请求的响应时间为 2 秒 -反对这些数字.我的问题也许是我是否可以只指定我的 SLA 并且产品/工具可以完成幕后的所有管道工作并为我提供表格答案?我知道......我知道......我在做白日梦:))
  6. 旁白:在 WCF 服务内部对请求进行排队的最佳方法是什么?

推荐答案

哇...标题绝对是冰山一角!希望我的回答不会偏离这里!:)

Wow...the title was definitely the tip of the iceberg! Hope I'm not way off base here on my responses! :)

  1. WCF 服务的性能测试可以通过多种不同的方式进行:使用测试工具,例如 Microsoft Team Test、Borland Silk Performer、Mercury LoadRunner,或者 LoadGen 或自定义测试工具.我的偏好是尝试采用您在创建某种功能单元测试然后将数据提供给该测试时所做的方法,同时使用测试工具来启动该测试的多个并发实例(虚拟用户").大多数商业测试工具的工具确实促进了这种类型的测试,因此在这里很难出错.最大的挑战通常来自维护测试用例和测试数据以支持测试应用程序.

  1. performance testing of WCF services can be done many different ways: using test tools such as Microsoft Team Test, Borland Silk Performer, Mercury LoadRunner, or something like LoadGen or a custom test harness. My preference is to try to take the approach that you've done in creating some sort of functional unit test and then feeding data into that test, while using the test tool to spin up multiple concurrent instances of that test (virtual 'users'). The tooling of most commercial test tools really facilitate this type of testing so its difficult to go wrong here. The biggest challenge usually grows out of maintaining the test cases and test data to support testing the application.

WCF 没有任何与性能相关的内置计数器.这实际上是一个盲点.当然,您可以看到与服务器建立了多少连接,但这是粗略的信息,您可能想知道哪些服务正在为这些请求提供服务.有传言称,作为为 WCF/WF 提供丰富托管环境的一部分,Microsoft 的Dublin"将包括为托管服务提供性能计数器.我们将不得不等待,看看实际会发生什么变化.

WCF doesn't have any built in counters related to performance. Thats actually a blind spot. Sure, you can see how many connections are being made to the server, but this is coarse information and you probably want to know which services are servicing those requests. Rumor is that Microsoft's 'Dublin', as part of providing a rich hosting environment for WCF/WF, will include surfacing performance counters for the hosted service. We will have to wait and see what actually shakes out.

如果我需要在不影响现有代码库的情况下检测 WCF 服务,我会研究可以从可应用于该服务的 WCF 行为中获得多少里程.这种自定义行为可能会显示您可能想要的性能计数器.

If I needed to instrument a WCF service without impacting the existing codebase I'd look into how much mileage I could get out of a WCF behavior that i could apply to the service. This custom behavior could likely surface the performance counters you might want.

是的.我会关心功能测试的结果(意思是性能?).需要注意的是,可能存在一些可以忽略的启动 (JIT).我可能希望分析功能测试的执行情况以获取执行指标 - 但我不会在性能运行期间打开代码分析.

Yes. I would care about results (meaning performance?) of a functional test. The caveat is that there is likely some startup (JIT) which can be ignored. I'd probably look to profile the execution of a functional test to get execution metrics - but i'd not turn on code profiling during a performance run.

对于 SLA 而言,自定义行为可能就是答案.您可以将操作指标记录到数据库中,然后报告出来.Amberpoint 和 SOA Software 等商业产品也将为此提供支持(包括性能计数器).

For SLA's again custom behaviors might be the answer. You could log operational metrics to a database and then report off that. Commercial products like Amberpoint and SOA Software will provide support for this as well (including performance counters).

对 wcf 服务的请求排队?我立即想到了 net.msmq 绑定,特别是如果您希望使请求持久.

Queuing requests to a wcf service? I immediately think of net.msmq binding, especially if your looking to make the request durable.

这篇关于为 WCF 服务定义 SLA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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