2012-08-24 68 views
2

我需要浏览某个网站上瓶颈的页面。我试图找到一个云端负载测试工具,它会从主页开始,下降到所有链接的1级,但我找不到这样的工具。 基本上,我需要的是插入URL,然后脚本随后像测试10或20个用户一样,从插入的页面链接到每个页面。这将为我提供网站上大多数页面加载时间的基本视图。具有抓取功能的云端负载测试工具

任何人都熟悉这样的工具? 我能找到的最接近的东西是jcrawl,但它需要安装jakarta ant,服务器配置以及什么不是,我认为我需要的是非常基本的,不需要几个小时才能进入脚本和配置。

感谢

+0

新增面露JMeter的标签,以提高反馈 –

回答

5

你可以做到这一点使用JMeter(JMeter是可以说是提供最好的免费和开源的负载测试工具)。您可以创建一个请求并使用正则表达式提取器来解析响应,提取任何href值,然后循环遍历每个找到的url。

下面是一个JMeter测试计划,它完全符合您的需求。只需将此xml复制到一个文本文件并将其保存为something.jmx。在JMeter中打开它并将演示主机名更改为您自己的站点(不要垃圾邮件,这是不好的形式)。 CTRL-R运行。

对于更多用户(线程)或迭代(循环),只需单击线程组名称并将值更改为所需。

非常模糊的建议:不要在一台PC上使用多于​​300个线程。

如果你想在“云”,然后租一个Amazon AWS机,install jmeter,这JMX文件复制到它,并且使用命令行运行它运行如下命令:

$ cd /to/where/jmeter/is/apache-blah/bin/

$ ./jmeter -n -t /path/to/my/testplan.jmx -l /where/to/put/results.jtl

演示抓取测试计划:

<?xml version="1.0" encoding="UTF-8"?> 
<jmeterTestPlan version="1.2" properties="2.3"> 
    <hashTree> 
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="crawl" enabled="true"> 
     <stringProp name="TestPlan.comments"></stringProp> 
     <boolProp name="TestPlan.functional_mode">false</boolProp> 
     <boolProp name="TestPlan.serialize_threadgroups">false</boolProp> 
     <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> 
     <collectionProp name="Arguments.arguments"/> 
     </elementProp> 
     <stringProp name="TestPlan.user_define_classpath"></stringProp> 
    </TestPlan> 
    <hashTree> 
     <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> 
     <collectionProp name="CookieManager.cookies"/> 
     <boolProp name="CookieManager.clearEachIteration">false</boolProp> 
     </CookieManager> 
     <hashTree/> 
     <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group Name" enabled="true"> 
     <stringProp name="ThreadGroup.on_sample_error">startnextloop</stringProp> 
     <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> 
      <boolProp name="LoopController.continue_forever">false</boolProp> 
      <stringProp name="LoopController.loops">1</stringProp> 
     </elementProp> 
     <stringProp name="ThreadGroup.num_threads">1</stringProp> 
     <stringProp name="ThreadGroup.ramp_time">1</stringProp> 
     <longProp name="ThreadGroup.start_time">1346172541000</longProp> 
     <longProp name="ThreadGroup.end_time">1346172541000</longProp> 
     <boolProp name="ThreadGroup.scheduler">false</boolProp> 
     <stringProp name="ThreadGroup.duration"></stringProp> 
     <stringProp name="ThreadGroup.delay"></stringProp> 
     </ThreadGroup> 
     <hashTree> 
     <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="homepage" enabled="true"> 
      <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> 
      <collectionProp name="Arguments.arguments"/> 
      </elementProp> 
      <stringProp name="HTTPSampler.domain">www.bbc.co.uk</stringProp> 
      <stringProp name="HTTPSampler.port"></stringProp> 
      <stringProp name="HTTPSampler.connect_timeout"></stringProp> 
      <stringProp name="HTTPSampler.response_timeout"></stringProp> 
      <stringProp name="HTTPSampler.protocol"></stringProp> 
      <stringProp name="HTTPSampler.contentEncoding"></stringProp> 
      <stringProp name="HTTPSampler.path">/</stringProp> 
      <stringProp name="HTTPSampler.method">GET</stringProp> 
      <boolProp name="HTTPSampler.follow_redirects">true</boolProp> 
      <boolProp name="HTTPSampler.auto_redirects">false</boolProp> 
      <boolProp name="HTTPSampler.use_keepalive">true</boolProp> 
      <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> 
      <boolProp name="HTTPSampler.monitor">false</boolProp> 
      <stringProp name="HTTPSampler.embedded_url_re"></stringProp> 
      <stringProp name="TestPlan.comments">enter YOUR SITE in the Server Name field</stringProp> 
     </HTTPSamplerProxy> 
     <hashTree> 
      <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="urls" enabled="true"> 
      <stringProp name="RegexExtractor.useHeaders">false</stringProp> 
      <stringProp name="RegexExtractor.refname">urls</stringProp> 
      <stringProp name="RegexExtractor.regex">&lt;a href=&quot;http:\/\/www.bbc.co.uk([^&quot;]+)&quot;</stringProp> 
      <stringProp name="RegexExtractor.template">$1$</stringProp> 
      <stringProp name="RegexExtractor.default">NOTFOUND</stringProp> 
      <stringProp name="RegexExtractor.match_number">-1</stringProp> 
      </RegexExtractor> 
      <hashTree/> 
      <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="Constant Throughput Timer" enabled="true"> 
      <doubleProp> 
       <name>throughput</name> 
       <value>6.0</value> 
       <savedValue>0.0</savedValue> 
      </doubleProp> 
      <stringProp name="calcMode">this thread only</stringProp> 
      <stringProp name="TestPlan.comments">Each thread makes 6 requests every minute (if it completes in time)</stringProp> 
      </ConstantThroughputTimer> 
      <hashTree/> 
     </hashTree> 
     <ForeachController guiclass="ForeachControlPanel" testclass="ForeachController" testname="ForEach Controller" enabled="true"> 
      <stringProp name="ForeachController.inputVal">urls</stringProp> 
      <stringProp name="ForeachController.returnVal">url</stringProp> 
      <boolProp name="ForeachController.useSeparator">true</boolProp> 
     </ForeachController> 
     <hashTree> 
      <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="foundUrl" enabled="true"> 
      <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> 
       <collectionProp name="Arguments.arguments"/> 
      </elementProp> 
      <stringProp name="HTTPSampler.domain">www.bbc.co.uk</stringProp> 
      <stringProp name="HTTPSampler.port"></stringProp> 
      <stringProp name="HTTPSampler.connect_timeout"></stringProp> 
      <stringProp name="HTTPSampler.response_timeout"></stringProp> 
      <stringProp name="HTTPSampler.protocol"></stringProp> 
      <stringProp name="HTTPSampler.contentEncoding"></stringProp> 
      <stringProp name="HTTPSampler.path">${url}</stringProp> 
      <stringProp name="HTTPSampler.method">GET</stringProp> 
      <boolProp name="HTTPSampler.follow_redirects">true</boolProp> 
      <boolProp name="HTTPSampler.auto_redirects">false</boolProp> 
      <boolProp name="HTTPSampler.use_keepalive">true</boolProp> 
      <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> 
      <boolProp name="HTTPSampler.monitor">false</boolProp> 
      <stringProp name="HTTPSampler.embedded_url_re"></stringProp> 
      <stringProp name="TestPlan.comments">enter YOUR SITE in the Server Name field</stringProp> 
      </HTTPSamplerProxy> 
      <hashTree> 
      <GaussianRandomTimer guiclass="GaussianRandomTimerGui" testclass="GaussianRandomTimer" testname="Gaussian Random Timer" enabled="true"> 
       <stringProp name="ConstantTimer.delay">300</stringProp> 
       <stringProp name="RandomTimer.range">500.0</stringProp> 
      </GaussianRandomTimer> 
      <hashTree/> 
      </hashTree> 
     </hashTree> 
     </hashTree> 
     <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true"> 
     <boolProp name="ResultCollector.error_logging">false</boolProp> 
     <objProp> 
      <name>saveConfig</name> 
      <value class="SampleSaveConfiguration"> 
      <time>true</time> 
      <latency>true</latency> 
      <timestamp>true</timestamp> 
      <success>true</success> 
      <label>true</label> 
      <code>true</code> 
      <message>true</message> 
      <threadName>true</threadName> 
      <dataType>true</dataType> 
      <encoding>false</encoding> 
      <assertions>true</assertions> 
      <subresults>true</subresults> 
      <responseData>false</responseData> 
      <samplerData>false</samplerData> 
      <xml>false</xml> 
      <fieldNames>true</fieldNames> 
      <responseHeaders>false</responseHeaders> 
      <requestHeaders>false</requestHeaders> 
      <responseDataOnError>false</responseDataOnError> 
      <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage> 
      <assertionsResultsToSave>0</assertionsResultsToSave> 
      <bytes>true</bytes> 
      <hostname>true</hostname> 
      <threadCounts>true</threadCounts> 
      </value> 
     </objProp> 
     <stringProp name="filename"></stringProp> 
     </ResultCollector> 
     <hashTree/> 
     <ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="Aggregate Report" enabled="true"> 
     <boolProp name="ResultCollector.error_logging">false</boolProp> 
     <objProp> 
      <name>saveConfig</name> 
      <value class="SampleSaveConfiguration"> 
      <time>true</time> 
      <latency>true</latency> 
      <timestamp>true</timestamp> 
      <success>true</success> 
      <label>true</label> 
      <code>true</code> 
      <message>true</message> 
      <threadName>true</threadName> 
      <dataType>true</dataType> 
      <encoding>false</encoding> 
      <assertions>true</assertions> 
      <subresults>true</subresults> 
      <responseData>false</responseData> 
      <samplerData>false</samplerData> 
      <xml>false</xml> 
      <fieldNames>true</fieldNames> 
      <responseHeaders>false</responseHeaders> 
      <requestHeaders>false</requestHeaders> 
      <responseDataOnError>false</responseDataOnError> 
      <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage> 
      <assertionsResultsToSave>0</assertionsResultsToSave> 
      <bytes>true</bytes> 
      <hostname>true</hostname> 
      <threadCounts>true</threadCounts> 
      </value> 
     </objProp> 
     <stringProp name="filename"></stringProp> 
     </ResultCollector> 
     <hashTree/> 
    </hashTree> 
    </hashTree> 
</jmeterTestPlan> 
+0

感谢队友,客户同时聘请了一家独立的公司来做基准测试,但我相信这对其他人寻找相同的东西会有帮助 – srgb