我使用卡桑德拉JMeter的插件https://github.com/slowenthal/jmeter-cassandra#cassandra-jmeter-plugin-for-cassandra我已經集成在Apache的JMeter2.9負載測試CassandraDB用JMeter
我有一個包含2數據中心和每個數據中心2個節點的羣集卡桑德拉。
JMeter的:
卡桑德拉連接:
contact points : 192.168.1.50,192.168.1.51,192.168.1.52
keyspace : test_db
卡桑德拉採樣
CQL Query : select * from test_db.feed_yogesh limit 1000;
Consistency Level : QUORUM
測試場景
1.Fetch 1000只記錄1個用戶
User/Thread : 1
Ramp-Up-Period : 0
Generate Summary Results = 1 in 2.2s = 0.5/s Avg: 2180 Min: 2180 Max: 2180 Err: 0 (0.00%)
2.Fetch 1000個記錄1000的用戶
我想測試爲多個用戶同時因此我加斜坡上升期間爲0,這根據JMeter將立即啓動所有用戶。
User/Thread : 1000
RampUp Period : 0
Summary Results = 1000 in 18s = 56.1/s Avg: 6857 Min: 5000 Max: 17044 Err: 987 (98.70%)
它並開始了我的所有用戶,但只有4-5用戶返回成功,其餘全部給我錯誤,如
All host(s) tried for query failed (tried: /192.168.1.50:9042 (com.datastax.driver.core.BusyConnectionException))
但是當我測試相同的1000用戶給予的加速期300返回所有成功。
User/Thread : 1000
RampUp Period : 300
Generate Summary Results = 1000 in 301s = 3.3/s Avg: 519 Min: 255 Max: 1811 Err: 0 (0.00%)
Cassndra Sampler.jmx
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.4" jmeter="2.9 r1437961">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" 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>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</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">1000</stringProp>
<stringProp name="ThreadGroup.ramp_time">0</stringProp>
<longProp name="ThreadGroup.start_time">1420788860000</longProp>
<longProp name="ThreadGroup.end_time">1420788860000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<org.apache.cassandra.jmeter.config.CassandraConnection guiclass="TestBeanGUI" testclass="org.apache.cassandra.jmeter.config.CassandraConnection" testname="Cassandra Connection" enabled="true">
<stringProp name="contactPoints">192.168.1.50,192.168.1.51,192.168.1.52</stringProp>
<stringProp name="keyspace">test_db</stringProp>
<stringProp name="loadBalancer">Default</stringProp>
<stringProp name="localDataCenter"></stringProp>
<stringProp name="password"></stringProp>
<stringProp name="sessionName">mydatabase</stringProp>
<stringProp name="username"></stringProp>
</org.apache.cassandra.jmeter.config.CassandraConnection>
<hashTree/>
<org.apache.cassandra.jmeter.sampler.CassandraSampler guiclass="TestBeanGUI" testclass="org.apache.cassandra.jmeter.sampler.CassandraSampler" testname="Cassandra Sampler" enabled="true">
<stringProp name="batchSize"></stringProp>
<stringProp name="consistencyLevel">QUORUM</stringProp>
<stringProp name="query">select * from test_db.feed_yogesh limit 1000;</stringProp>
<stringProp name="queryArguments">Running</stringProp>
<stringProp name="queryType">Simple Statement</stringProp>
<stringProp name="resultVariable"></stringProp>
<stringProp name="sessionName">mydatabase</stringProp>
<stringProp name="variableNames">VARCHAR</stringProp>
</org.apache.cassandra.jmeter.sampler.CassandraSampler>
<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>false</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
<ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary 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>false</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
我很困惑,這是否意味着多個用戶的cannnot讀取數據的同時我們強制需要添加斜坡向上週期值。
我認爲這是一個低配置問題,因爲當我嘗試1000線程/用戶加速0和100記錄的限制一切工作完全正常,但是當我將限制增加到1000很多線程失敗。 – Yasmeen