如何使用jMeter测试SAP OData服务并发访问时的性能

797 篇文章 33 订阅

For project reason I have to measure the performance of OData service being accessed parallelly. And I plan to use the open source tool JMeter to generate a huge number of request in parallel and measure the average response time. Since I am a beginner for JMeter, I write down what I have learned into this blog.

I will continue to explorer the advanced feature of JMeter in my daily work.

(1) Download JMeter from its official website.
Go to the installation folder, add the following text in file \bin\user.properties:

httpclient4.retrycount=1
hc.parameters.file=hc.parameters

(2) Create a new test plan for example Customer_Query_OData_test, and right click on it and create a thread group from context menu.

Below configuration means I would like to generate three request in parallel via three threads, each thread is executed only once. And there is no delay during the spawn of each threads ( Ramp-Up Period = 0 )

Create a new Http Request and maintain the following settings:

  • Protocol: https
  • Server name:
  • Http request method: GET
  • Http path: /sap/c4c/odata/v1/c4codata/AccountCollection/
  • Use KeepAlive: do NOT select this checkbox
    In Parameter tab, maintain query option $search with value ‘Wang’

Switch to Advanced tab, choose “HttpClient4” from drop down list for Implementation, and maintain proxy server name and port number.

(3) Create a new HTTP Header Manager and specify the basic authentication header field and value.

(4) Create a listener for the test plan. In my test I simply choose the most simple one: View Results in Table.

Once done, start the test:

After the test is finished, double click on View Result Listener and the response time for each request and the average response time is displayed there:

Or you can use command line to achieve the same:

  • -n: use non-GUI mode
  • -t: specify which test plan you want to run
  • -l: specify the path of output result file

And I have written a simple Java application to generate parallel request via multiple thread and the result measured in Java program is consistent with the one got from JMeter.

How to generate random query for each thread in JMeter

Suppose we would like each thread in JMeter to generate different customer query via OData with the format JerryTestCustomer_<1~100>, we can simply create a new user parameter:

  • Parameter name: uuid
  • Parameter value: use JMeter predefined function __Random to generate random number. So the value is: ${__Random(1,100)}

and in http request, just specify reference to this variable via ${uuid}:

So that in the end each thread will issue different query to OData service end point.



Further reading

You can find a list of all other blogs related to OData written by Jerry.

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

汪子熙

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值