用于ant任务的具有Not Gui模式的JMeter不在从属节点上运行(JMeter with Not Gui mode for ant task doesn't run on slave node)
我根据本手册配置了JMeter集群测试 - JMeter Distributed Testing循序渐进
这两台机器都是带有禁用防火墙的CentOS 6 ,并且具有相同版本的JMeter。
Project已使用JMeter的Java Samples构建:
所有电话都将结束。 通过RMI调用,如果准确的话。
主节点配置 :
使用从IP更新了
jmeter.properties
运行Jenkins作业 - > ant调用JMeter ant任务 - >在Jmeter上启动测试(它使用java的采样器构建了jar)。
JDK 1.7.25 / ant 1.9.4 / JMeter 2.11;
从节点配置:
JDK 1.7.90 / ant 1.7.1 / JMeter 2.11;
启动
jmeter-server
。启动测试工作后。 它仅在主节点上执行。 发送到从节点的请求没有发生。
我无法理解为什么会这样。这是ant任务的片段:
<target name="jmeter-test" depends="jmeter-init, is_run_remote"> <jmeter jmeterhome="${jmeter.home}" testplan="${basedir.unix}/${test.testplan.path}" resultlog="${basedir.unix}/${results.report.jmeter.generated.path}" failureproperty="test_failed" runremote="${is_remote}"> <!-- jvm settings --> <jvmarg value="-Xms${jvm.xms}"/> <jvmarg value="-Xmx${jvm.xmx}"/> <!-- jmeter remoting properties --> <property name="remote_hosts" value="${remote_hosts}" /> <property name="client.rmi.localport" value="${client.rmi.localport}" /> <property name="java.rmi.server.hostname" value="${java.rmi.server.hostname}" /> <property name="server.exitaftertest" value="${server.exitaftertest}" /> <property name="client.rmi.localport" value="${client.rmi.localport}" remote="true" /> <property name="server.rmi.localport" value="${server.rmi.localport}" remote="true" /> <property name="sample_sender_client_configured" value="${sample_sender_client_configured}" remote="true" /> <property name="mode" value="${remote.results.sending.mode}" remote="true" /> <property name="asynch.batch.queue.size" value="${asynch.batch.queue.size}" remote="true" />
与
jmeter.log
的主要区别在于通常的测试通过编译采样器:jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: post.PostFreightSearchSampler. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: post.PostVehicleSearchSampler. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: post.region.PostFreightRegionalSearchSampler. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: post.region.PostVehicleRegionalSearchSampler. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: post.country.PostFreightCountrySearchSampler. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: post.country.PostVehicleCountrySearchSampler. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: search.execute.ExecuteFreightSearch. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: search.execute.ExecuteVehicleSearch. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: search.execute.ExecuteFreightSearch. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: search.execute.ExecuteVehicleSearch. Uses tearDownTest: false
在远程运行的情况下,它有不同的行为:
jmeter.engine.ClientJMeterEngine: sent test to 127.0.0.1 basedir='.' ... set the run props jmeter.engine.ClientJMeterEngine: sent run command to 127.0.0.1 2016/07/25 14:59:13 INFO - jmeter.JMeter: Remote engines have been started 2016/07/25 14:59:13 INFO - jmeter.JMeter: Started remote host: 127.0.0.1 (1469447953598) 2016/07/25 14:59:13 INFO - jmeter.samplers.SampleResult: Note: Sample TimeStamps are START times 2016/07/25 14:59:13 INFO - jmeter.samplers.SampleResult: sampleresult.default.encoding is set to ISO-8859-1 2016/07/25 14:59:13 INFO - jmeter.samplers.SampleResult: sampleresult.useNanoTime=true 2016/07/25 14:59:13 INFO - jmeter.samplers.SampleResult: sampleresult.nanoThreadSleep=5000 2016/07/25 14:59:13 INFO - jmeter.reporters.Summariser: summary = 1 in 0s = ******/s Avg: 0 Min: 0 Max: 0 Err: 1 (100.00%) 2016/07/25 14:59:13 INFO - jmeter.JMeter: Finished remote host: 127.0.0.1 (1469447953740)
如何进行分布式测试?
I have configured JMeter cluster testing according to this manual - JMeter Distributed Testing Step-by-step
Both machines are CentOS 6 with disabled firewalls and have the same version of JMeter.
Project has built with JMeter's Java Samples:
All calls are going to back end. Through RMI calls, if to be accurate.
Master node configuration:
Updated
jmeter.properties
with slave IPRun Jenkins job -> ant calls JMeter ant task -> launches test on Jmeter (it has built jar with java's sampler).
JDK 1.7.25 / ant 1.9.4 / JMeter 2.11;
Slave node configuration:
JDK 1.7.90 / ant 1.7.1 / JMeter 2.11;
Started
jmeter-server
.After launching test job. It executes only on the master node. Request sending to slave node didn't happen.
I couldn't get a klue why this happenning.Here is snippet from ant task:
<target name="jmeter-test" depends="jmeter-init, is_run_remote"> <jmeter jmeterhome="${jmeter.home}" testplan="${basedir.unix}/${test.testplan.path}" resultlog="${basedir.unix}/${results.report.jmeter.generated.path}" failureproperty="test_failed" runremote="${is_remote}"> <!-- jvm settings --> <jvmarg value="-Xms${jvm.xms}"/> <jvmarg value="-Xmx${jvm.xmx}"/> <!-- jmeter remoting properties --> <property name="remote_hosts" value="${remote_hosts}" /> <property name="client.rmi.localport" value="${client.rmi.localport}" /> <property name="java.rmi.server.hostname" value="${java.rmi.server.hostname}" /> <property name="server.exitaftertest" value="${server.exitaftertest}" /> <property name="client.rmi.localport" value="${client.rmi.localport}" remote="true" /> <property name="server.rmi.localport" value="${server.rmi.localport}" remote="true" /> <property name="sample_sender_client_configured" value="${sample_sender_client_configured}" remote="true" /> <property name="mode" value="${remote.results.sending.mode}" remote="true" /> <property name="asynch.batch.queue.size" value="${asynch.batch.queue.size}" remote="true" />
The main difference from
jmeter.log
is that usual test goes through compiling Samplers:jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.functions.StringFromFile: setParameters(${LISTING_USERS_CSV}) 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: post.PostFreightSearchSampler. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: post.PostVehicleSearchSampler. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: post.region.PostFreightRegionalSearchSampler. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: post.region.PostVehicleRegionalSearchSampler. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: post.country.PostFreightCountrySearchSampler. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: post.country.PostVehicleCountrySearchSampler. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: search.execute.ExecuteFreightSearch. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: search.execute.ExecuteVehicleSearch. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: search.execute.ExecuteFreightSearch. Uses tearDownTest: false 2016/07/19 14:36:17 INFO - jmeter.protocol.java.sampler.JavaSampler: Created class: search.execute.ExecuteVehicleSearch. Uses tearDownTest: false
At case of remoting run it has different behavior:
jmeter.engine.ClientJMeterEngine: sent test to 127.0.0.1 basedir='.' ... set the run props jmeter.engine.ClientJMeterEngine: sent run command to 127.0.0.1 2016/07/25 14:59:13 INFO - jmeter.JMeter: Remote engines have been started 2016/07/25 14:59:13 INFO - jmeter.JMeter: Started remote host: 127.0.0.1 (1469447953598) 2016/07/25 14:59:13 INFO - jmeter.samplers.SampleResult: Note: Sample TimeStamps are START times 2016/07/25 14:59:13 INFO - jmeter.samplers.SampleResult: sampleresult.default.encoding is set to ISO-8859-1 2016/07/25 14:59:13 INFO - jmeter.samplers.SampleResult: sampleresult.useNanoTime=true 2016/07/25 14:59:13 INFO - jmeter.samplers.SampleResult: sampleresult.nanoThreadSleep=5000 2016/07/25 14:59:13 INFO - jmeter.reporters.Summariser: summary = 1 in 0s = ******/s Avg: 0 Min: 0 Max: 0 Err: 1 (100.00%) 2016/07/25 14:59:13 INFO - jmeter.JMeter: Finished remote host: 127.0.0.1 (1469447953740)
How to make distributed testing?
原文:https://stackoverflow.com/questions/38535103
最满意答案
Angular中的所有
$http
调用都会返回一个承诺。
$q
服务没有Q库中的所有功能,但是如果您查看文档 ,它确实有一个可以用来为您提供所需功能的all
方法。以下是您可以如何使用它的方法:
app.controller('HttpController', function($http, $q) { // A hypothetical submit function $scope.submit = function() { // Set a loading variable for use in the view (to show the spinner) $scope.loading = true; var call1 = $http.get(/* ... */); var call2 = $http.get(/* ... */); var call3 = $http.get(/* ... */); $q.all([call1, call2, call3]).then(function(responses) { // responses will be an array of values the individual // promises were resolved to. For this case, we don't // need it, since we only care that they all resolved // successfully. $scope.loading = false; }, function(errorValue) { // If any of the promises is rejected, the error callback // will be resolved with that rejection value, kind of like // an early exit. We want to mark the loading variable // as false here too, and do something with the error. $scope.loading = false; }); }; });
All
$http
calls in Angular return a promise.The
$q
service doesn't have all the bells and whistles of the Q library, which it is based, but if you look at the docs, it does have anall
method that can be used to give you the functionality you want.Here's how you could use it:
app.controller('HttpController', function($http, $q) { // A hypothetical submit function $scope.submit = function() { // Set a loading variable for use in the view (to show the spinner) $scope.loading = true; var call1 = $http.get(/* ... */); var call2 = $http.get(/* ... */); var call3 = $http.get(/* ... */); $q.all([call1, call2, call3]).then(function(responses) { // responses will be an array of values the individual // promises were resolved to. For this case, we don't // need it, since we only care that they all resolved // successfully. $scope.loading = false; }, function(errorValue) { // If any of the promises is rejected, the error callback // will be resolved with that rejection value, kind of like // an early exit. We want to mark the loading variable // as false here too, and do something with the error. $scope.loading = false; }); }; });
相关问答
更多-
感谢史蒂夫的提示,我能够实现装载机: 拦截器: .factory('httpInterceptor', function ($q, $rootScope, $log) { var numLoadings = 0; return { request: function (config) { numLoadings++; // Show loader $rootScope.$broadcast("lo ...
-
这是以前的AngularJS咒语: angular.module('SharedServices', []) .config(function ($httpProvider) { $httpProvider.responseInterceptors.push('myHttpInterceptor'); var spinnerFunction = function (data, headersGetter) { // todo start the ...
-
Angular HTTP Interceptor - 在多模块应用程序中显示微调器(Angular HTTP Interceptor - Display spinner in multi-module app)[2022-04-12]
问题是ApiService使用来自@angular/http而不是来自@angular/common/http的HttpClient 。 所以ApiInterceptor没有任何可以拦截的东西。 The issue was the ApiService was using the Http from @angular/http instead of HttpClient from @angular/common/http. So the ApiInterceptor has nothing to inter ... -
Angular中的所有$http调用都会返回一个承诺。 $q服务没有Q库中的所有功能,但是如果您查看文档 ,它确实有一个可以用来为您提供所需功能的all方法。 以下是您可以如何使用它的方法: app.controller('HttpController', function($http, $q) { // A hypothetical submit function $scope.submit = function() { // Set a loading variable for use ...
-
我认为你缺少显示/隐藏的绑定,具体取决于visible状态:
-
你很近,用一个闭包来代替: var someFunct = function () { for (var i = 0; i < Apples.length; i++) { (function (Apple) { $http.get("APIUrl" + Apple.Id) .success(function (response) { for (var i = 0; i < response.Applese ...
-
如果我理解正确(最后),这就是你想要实现的目标: 输入: 承诺清单 所有承诺都已解决后将被调用的回调 每次任何承诺被拒绝时都要调用的回调 行为: 您想要并行执行(不是顺序)。 您希望所有承诺都得到解决或拒绝(即使一个承诺被拒绝,其余承诺应该像往常一样继续)。 您希望将“最终”回调调用一次(接收结果数组 - 无论相应的延迟是否已解决或拒绝)。 $q.all应该“增加”以满足您的需求,因为默认情况下: 一旦列表中的任何承诺被拒绝,它立即被拒绝。 如果拒绝,它只返回拒绝原因而不是结果列表。 这是一个可能的实现: ...
-
你的角度代码很好,虽然你错过了一件小事。 我修改了你的代码并进行了测试,它按预期工作。 解: var myUrl= ""; app.post('/post', function(req, res){ //not res.url myUrl = req.url; //Your missed this! res.status(204).end(); }); app.get('/get, function(req, res){ res.json({result: myUrl}) ...
-
中止AngularJS $ http请求,深度嵌套在多个服务调用中(Abort AngularJS $http request, deeply nested in multiple service calls)[2021-07-19]
乔尔,我对此并不是百分之百确定,但我会根据你已经尝试过的东西试一试。 整个事情似乎依赖于在RestService中提供一个可解析的timeout: Promise $http()配置映射中的timeout: Promise选项,并以某种方式返回一个带有.abort()方法的promise以及它的标准方法; 然后确保.abort()方法通过DataService“继承”到Controller中。 要实现这一目标需要几个小技巧。 我猜你可以这样做: //RestService: app.service("res ... -
嗨因为这是一个承诺,你可以链接下一个调用then函数 $http(url). then(function(response){ //note that this shouldn't be the body of the response // but the entire response stream so you need to check for the status code and the body and apply and possibly ...